Skip to content

fix(viewer): drop the EntityRef-keyed selection half in clearAllModels too - #3372

Open
BIMvoice wants to merge 1 commit into
mainfrom
fix-3348-clear-all-models-entityref
Open

fix(viewer): drop the EntityRef-keyed selection half in clearAllModels too#3372
BIMvoice wants to merge 1 commit into
mainfrom
fix-3348-clear-all-models-entityref

Conversation

@BIMvoice

Copy link
Copy Markdown
Collaborator

Summary

  • clearAllModels()'s all-models-cleared teardown scope cleared only the global-id half of selection state (selectedEntityId/selectedEntityIds/selectedStoreys). The EntityRef-keyed half (selectedEntity/selectedEntities/selectedEntitiesSet/selectedModelId/activeStorey) survived, still naming models clearAllModels() had just removed.
  • resetViewerState() already clears both halves, so the asymmetry only showed on a path that calls clearAllModels() without it — GeoreferencingPanel.tsx's reloadModelsForAlignment, which reloads models after clearAllModels() alone.
  • Fix: since clearAllModels removes every model, there is no surviving federated sibling to preserve a selection for (unlike the single-model model-removed scope, which filters by modelId), so the all-models-cleared arm now clears both halves unconditionally — same shape session-reset already used for this slice.
  • Updated PINNED_ALL_MODELS_CLEARED_KEYS in teardown-registry.test.ts to include the five newly-emitted keys.

Refs #3348.

Test plan

  • apps/viewer/src/store/clearAllModels-selection-stale.test.ts — new test, confirmed RED against the pre-fix arm (selectedEntity/selectedEntities/selectedEntitiesSet/selectedModelId/activeStorey all survived clearAllModels()), GREEN after the fix.
  • teardown-registry.test.ts, selectionSlice.test.ts, clearAllModels-overlay-stale.test.ts, removeModel-*.test.ts, resetViewerState.*.test.ts, teardown.idempotence.test.ts, *.solid-teardown.test.ts — 88/88 passing.
  • tsc --noEmit clean for apps/viewer.
  • node scripts/check-module-size.mjs exits 0.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QPHChk3Ve9N519A4kY7436

…s too (#3348)

The `all-models-cleared` teardown scope cleared only the global-id half of
selection (`selectedEntityId`/`selectedEntityIds`/`selectedStoreys`); the
EntityRef-keyed half (`selectedEntity`/`selectedEntities`/
`selectedEntitiesSet`/`selectedModelId`/`activeStorey`) survived pointing at
models `clearAllModels()` had just removed. `resetViewerState()` clears both
halves, so the asymmetry only surfaced on the georeference-reload path that
calls `clearAllModels()` without it.

Since every model is gone in this scope there is no surviving sibling to
preserve a selection for, so both halves now clear unconditionally.

Claude-Session: https://claude.ai/code/session_01QPHChk3Ve9N519A4kY7436
@vercel

vercel Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
ifc-lite-dev Ignored Ignored Aug 28, 2026 4:43am

@BIMvoice
BIMvoice requested a review from louistrue as a code owner August 28, 2026 04:43
@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

This review includes 4 billable files and costs up to $1.00.

Or wait 34 minutes for your next included review.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 37c142ba-9831-432b-acce-accea6fb1021

📥 Commits

Reviewing files that changed from the base of the PR and between 5a431e5 and 08c026b.

📒 Files selected for processing (4)
  • .changeset/clear-all-models-selection-reset.md
  • apps/viewer/src/store/clearAllModels-selection-stale.test.ts
  • apps/viewer/src/store/slices/selectionSlice.teardown.ts
  • apps/viewer/src/store/teardown-registry.test.ts

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

Viewer benchmark

✅ No threshold regressions detected.

01_Snowdon_Towers_Sample_Structural(1).ifc

Baseline recorded 2026-07-01T20:31:05.538Z on github-actions ubuntu-latest, viewer-benchmark-ci (headless Chrome, SwiftShader ANGLE), production build.

Metric Current Baseline Delta Threshold Status
firstBatchWaitMs 1475ms 2905ms -49.2% +50%
firstVisibleGeometryMs 2214ms 3652ms -39.4% +50%
streamCompleteMs 2514ms 3598ms -30.1% +50%
spatialReadyMs 1474ms 1032ms +42.8% +50%
metadataCompleteMs 2015ms 3063ms -34.2% +50%
totalWallClockMs 2600ms 3700ms -29.7% +50%

AC20-FZK-Haus.ifc

Baseline recorded 2026-07-01T20:30:59.972Z on github-actions ubuntu-latest, viewer-benchmark-ci (headless Chrome, SwiftShader ANGLE), production build.

Metric Current Baseline Delta Threshold Status
firstBatchWaitMs 396ms 1075ms -63.2% +50%
firstVisibleGeometryMs 1239ms 1572ms -21.2% +50%
streamCompleteMs 1208ms 1980ms -39.0% +50%
spatialReadyMs 931ms 915ms +1.7% +50%
metadataCompleteMs 1070ms 1392ms -23.1% +50%
totalWallClockMs 1400ms 3300ms -57.6% +50%

Refresh the baseline from a CI run: dispatch the Benchmark workflow with record_baseline, download the benchmark-baseline artifact, and commit baseline.json (see tests/benchmark/README.md).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant