feat(web): deployed functional suite, outliner expansion fix and local-first runs
Some checks failed
M6 deployable RC / quick (push) Has been cancelled
M6 deployable RC / chromium (push) Has been cancelled
M6 deployable RC / release (push) Has been cancelled

Outliner: react-accessible-treeview's controlled expandedIds sync expands a
node together with its parent, then the next pass treats that extra parent id
as removed from the controlled set and collapses the whole branch. Reproduced
as a collapsed tree after ch11 -> ch12 (scene rows complete in React, one
collapsed row in the DOM). Keep OUTLINER_ROOT_ID in the controlled set so both
passes agree, and drop the rows-digest memo that regressed the normal path.
Also arm a bounded post-open OUTLINER_REFRESH loop so the tree settles on rows
of the newly opened Main instead of the previous one.

Tests: web/playwright.deployed.config.ts + web/tests/deployed walk the 31
manual chapters and the 31 capability rows headed against a deployed origin,
and tools/web/run-deployed-functional-tests.mjs preflights, runs and reports.
--local serves the production bundle from web/dist on loopback with the same
COOP/COEP/CORP/CSP headers, so a case costs compile time instead of a 300 MB
download: full local suite 60/60 in 10.3 min, also 60/60 against the deployed
release. Report dirs are resolved absolute and [ch28a]-style tags map to their
chapter.

Area layout: split from the clamped source rect and keep the area switcher
inside a narrow header.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
mes123456
2026-11-24 16:12:26 +08:00
parent 570aa2dd54
commit a5f772e18f
162 changed files with 9341 additions and 8 deletions

View File

@@ -2502,7 +2502,7 @@ function Outliner({ snapshot, areaId, onSelect, onToggleVisibility, onRefresh, o
event.preventDefault();
onReparent(ids, null, !event.altKey);
}}>
<OutlinerTreeView rows={tree.rows}
<OutlinerTreeView rows={tree?.rows ?? []}
onExpand={(rowId) => onToggleExpand?.(rowId, false, nativeArea.id)}
onSelect={(rowId) => onTreeSelect?.(rowId, false, false, nativeArea.id, false, false)}
renderRow={(row, nodeProps) => {
@@ -5652,6 +5652,17 @@ export function App({localOnly=false,course}:{localOnly?:boolean;course?:Availab
return { meshId, mode, indices: combined, nonMeshKind, nonMeshSelections: selections, greasePencilPoints: undefined };
});
};
/* A successful .blend open arms this counter; the effect below fires
* OUTLINER_REFRESH once the open lock is released, because the open reply can
* still carry the previous Main's Outliner row list (desktop rebuilds it from
* Main). One refresh is not enough: the native rebuild after an open
* alternately leaves the tree collapsed to "Scene Collection" (probe: refresh
* #1 collapsed, #2 expanded, #3 collapsed), so keep refreshing — bounded —
* until the rows carry an object of the opened scene. */
const pendingOpenOutlinerRefreshRef = useRef(0);
/* True once the post-open rows survived a quiet period; see the effect below. */
const openOutlinerVerifiedRef = useRef(false);
const [outlinerSettleTick, setOutlinerSettleTick] = useState(0);
const refreshOutliner = (areaId?: string): void => {
const workflow = snapshot?.editorWorkflow;
const nativeWorkspace = workflow?.workspaces.find(item => item.id === workflow.context.workspaceId);
@@ -5672,6 +5683,36 @@ export function App({localOnly=false,course}:{localOnly?:boolean;course?:Availab
},
});
};
useEffect(() => {
if (pendingOpenOutlinerRefreshRef.current <= 0 || projectActionLocked || !snapshot) return;
const effectWorkflow = snapshot.editorWorkflow;
const effectWorkspace = effectWorkflow?.workspaces.find(item => item.id === effectWorkflow.context.workspaceId);
const effectRows = effectWorkspace?.areas.find(item => item.editor === 'OUTLINER' &&
item.regions.some(region => region.kind === 'MAIN' && region.visible))?.space?.outliner?.rows ?? [];
/* Nodes carry `id:OBBasicCube`; Outliner rows carry `object:BasicCube`,
* so compare in one namespace or the gate can never be satisfied. */
const objectIds = new Set(snapshot.nodes.map(node => node.id.replace(/^id:OB/, 'object:')));
const rowsCarryObjects = effectRows.some(row => row.objectId && objectIds.has(row.objectId));
if (rowsCarryObjects && openOutlinerVerifiedRef.current) {
pendingOpenOutlinerRefreshRef.current = 0;
return;
}
if (rowsCarryObjects) {
/* A good row list right after an open is not final: the mode switch that
* completes a file open rebuilds the native tree once more, and that
* rebuild can leave it collapsed again. Only settle after the rows
* survive a quiet period without another refresh. */
const timer = window.setTimeout(() => { openOutlinerVerifiedRef.current = true; setOutlinerSettleTick(tick => tick + 1); }, 2_000);
return () => window.clearTimeout(timer);
}
openOutlinerVerifiedRef.current = false;
pendingOpenOutlinerRefreshRef.current -= 1;
refreshOutliner();
/* Keyed on the snapshot object, not its revision: an OUTLINER_REFRESH reply
* carries the same revision but a new snapshot, and keying on revision let
* the loop die after its first attempt — on the collapsed parity. */
// eslint-disable-next-line react-hooks/exhaustive-deps -- refreshOutliner stays as the latest render's closure
}, [projectActionLocked, snapshot, outlinerSettleTick]);
const toggleOutlinerExpand = (rowId: string, toggleAll: boolean, areaId: string): void => {
const workflow = snapshot?.editorWorkflow;
const nativeWorkspace = workflow?.workspaces.find(item => item.id === workflow.context.workspaceId);
@@ -7856,6 +7897,16 @@ export function App({localOnly=false,course}:{localOnly?:boolean;course?:Availab
catch (error) { setStorageStatus(recordDiagnostic("STORAGE", "OPERATION_LOG_FAILED", error, { recovery: "library-open-checkpoint" })); }
}
succeedUserAction(identity);
/* Desktop rebuilds the Outliner from Main on every file open; the open
* reply can still carry the previous Main's row list (reproduced as
* ch08 -> ch11 and ch11 -> ch12: fresh scene, stale or empty tree). The
* refresh itself must wait for the lock release and the rendered
* snapshot — see pendingOpenOutlinerRefreshRef above. Successive refreshes
* alternate between collapsed and expanded replies, and the mode switch
* that finishes an open rebuilds once more, so the loop needs several
* attempts and a quiet-period check before it settles. */
openOutlinerVerifiedRef.current = false;
pendingOpenOutlinerRefreshRef.current = 6;
return true;
} catch (error) {
if ((error && typeof error === "object" && "code" in error && error.code === "OPEN_CANCELLED" && !("detail" in error && error.detail)) || (error instanceof FileByteReadError && error.code === "FILE_READ_CANCELLED")) {

View File

@@ -89,17 +89,19 @@ button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-
.area-type-switch { position: absolute; top: 2px; right: 3px; z-index: 6; display: flex; align-items: center; gap: 2px; max-width: calc(100% - 6px); padding: 1px 3px; border-radius: 3px; background: #1d1d1dcc; color: #c9c9c9; font-size: 10px; opacity: 0; pointer-events: none; transition: opacity .12s; }
.area-frame:hover > .area-type-switch, .area-frame:focus-within > .area-type-switch { opacity: .9; pointer-events: auto; }
/* Areas with a visible header carry the switcher inside it instead. */
.editor-header > .area-type-switch { position: static; max-width: none; opacity: 1; pointer-events: auto; background: transparent; }
.editor-header > .area-type-switch { position: relative; z-index: 3; flex: 0 0 auto; min-width: 0; max-width: none; opacity: 1; pointer-events: auto; background: transparent; }
.area-type-switch:hover, .area-type-switch:focus-within { opacity: 1; }
@media (hover: none) { .area-type-switch { opacity: .6; pointer-events: auto; } }
.area-type-switch select { min-width: 0; max-width: 160px; padding: 1px 2px; border: 1px solid #4a4a4a; border-radius: 2px; background: #2a2a2a; color: #ddd; font-size: 10px; }
.area-type-switch span { flex: none; }
.editor-header { display: flex; align-items: center; flex: none; min-height: 27px; padding: 0 4px; background: #292929; border-bottom: 1px solid #151515; box-shadow: inset 0 -1px #333; }
.editor-selector, .icon-button { display: inline-flex; align-items: center; gap: 6px; min-width: 24px; min-height: 24px; padding: 4px 6px; background: transparent; color: #e1e3e7; border-radius: 3px; }
.editor-header { position: relative; z-index: 2; display: flex; align-items: center; gap: 2px; flex: none; min-width: 0; min-height: 27px; padding: 0 4px; background: #292929; border-bottom: 1px solid #151515; box-shadow: inset 0 -1px #333; }
.editor-selector, .icon-button { display: inline-flex; align-items: center; gap: 6px; flex: 0 1 auto; min-width: 24px; min-height: 24px; padding: 4px 6px; background: transparent; color: #e1e3e7; border-radius: 3px; }
/* A narrow area must squeeze the label, not push the ⋮ switcher out of the header. */
.editor-selector > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editor-selector:hover, .icon-button:hover { background: #414141; }
.editor-icon { color: #e67e22; font-size: 14px; }
.icon-button { color: #aaa; }
.area-content { position: relative; flex: 1; min-height: 0; overflow: auto; }
.area-content { position: relative; z-index: 0; flex: 1; min-width: 0; min-height: 0; overflow: auto; }
.viewport-area { grid-column: 1; grid-row: 1 / 3; }
.outliner-area { grid-column: 2; grid-row: 1; }
.properties-area { grid-column: 2; grid-row: 2 / 4; }

View File

@@ -27,7 +27,12 @@ export function OutlinerTreeView<T extends OutlinerTreeSourceRow>({ rows, ariaLa
const dataKey = useMemo(() => data.map((node) => String(node.id)).join("\u0000"), [data]);
const allowSelect = useRef(false);
const rowsById = useMemo(() => new Map(rows.map((row) => [String(row.id), row])), [rows]);
const expanded = useMemo(() => expandedRowIds(rows), [rows]);
/* react-accessible-treeview's controlled-expanded sync expands a node together
* with its parent, then on the next pass treats that extra parent id as removed
* from the controlled set and collapses the whole branch — observed as
* COLLAPSE_MANY [root, scene, ...] right after an open. The root id is never a
* rendered row, so keeping it in the set makes both passes agree. */
const expanded = useMemo(() => [OUTLINER_ROOT_ID, ...expandedRowIds(rows)], [rows]);
const selected = useMemo(() => selectedRowIds(rows), [rows]);
return <div className="outliner-tree-view" onPointerDownCapture={() => { allowSelect.current = true; }} onKeyDownCapture={() => { allowSelect.current = true; }}>
<TreeView