Skip to content

Commit c8fd84c

Browse files
committed
test: assert the interval pause, and document accessor non-reactivity
Splitting the interval spies from the rAF ones left both unasserted, so deleting pauseChangeDetection() from destroy() went unnoticed here. The cleanup case now asserts one spy per loop. Also carries the plain-number caveat onto the interface, which is the surface a new consumer reads before the implementation.
1 parent cfbff04 commit c8fd84c

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

src/renderer/core/layout/types.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,12 @@ export interface LayoutChange {
271271
export interface LayoutStore {
272272
/** Node count, without materialising layouts as `getAllNodes()` does. */
273273
readonly nodeCount: number
274-
/** Cache key for derived structures; see the implementation for its scope. */
274+
/**
275+
* Cache key for derived structures; see the implementation for its scope.
276+
*
277+
* Plain numbers on a non-reactive class instance: reading either inside a
278+
* `computed` or `watch` tracks nothing and never re-evaluates. Poll them.
279+
*/
275280
readonly layoutVersion: number
276281
/** Cache key for geometry-derived state; moves only when nodes move. */
277282
readonly nodeGeometryVersion: number

src/renderer/extensions/minimap/composables/useMinimap.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,10 @@ describe('useMinimap', () => {
427427
await minimap.init()
428428
minimap.destroy()
429429

430+
// Both loops: rAF drives viewport sync, the interval drives change
431+
// detection. One spy each, or deleting either pause here goes unnoticed.
430432
expect(mockPause).toHaveBeenCalled()
433+
expect(mockIntervalPause).toHaveBeenCalled()
431434
expect(api.removeEventListener).toHaveBeenCalledWith(
432435
'graphChanged',
433436
expect.any(Function)

0 commit comments

Comments
 (0)