core(space-detection): add pause/resume refcount primitive (#336)

initSpaceDetectionSync subscribes to every scene mutation and auto-derives
slabs/ceilings from wall topology. When a host app drives explicit
slab/ceiling creation (e.g. the community editor's AI create_room flow),
the auto-sync races those nodes and the polygon-signature de-dupe is
fragile enough that duplicates leak through.

Expose pauseSpaceDetection / resumeSpaceDetection / isSpaceDetectionPaused
mirroring the existing pauseSceneHistory refcount in store/history-control.
While paused, the subscriber rolls previousSnapshots forward so resume
does NOT trigger a backfill that would re-introduce the very duplicates
the host paused to avoid.

No behavior change for callers that don't touch the new functions.
This commit is contained in:
Wassim SAMAD
2026-05-26 15:04:48 -04:00
committed by GitHub
parent f5ff111708
commit 814d94336b
3 changed files with 92 additions and 0 deletions
+3
View File
@@ -56,7 +56,10 @@ export {
type AutoSlabSyncPlan,
detectSpacesForLevel,
initSpaceDetectionSync,
isSpaceDetectionPaused,
pauseSpaceDetection,
planAutoSlabsForLevel,
resumeSpaceDetection,
type Space,
wallTouchesOthers,
} from './lib/space-detection'