@adobe/data-lit 0.10.14 → 0.10.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,36 +1,40 @@
1
1
  import type { Component } from "./component.js";
2
2
  /**
3
- * Give a hook host a real disconnect edge.
3
+ * Give a hook host a correct lifecycle by separating two concerns that the DOM
4
+ * connect/disconnect edge conflates.
4
5
  *
5
- * The hook model stores every effect's cleanup in `host.hooks[i].dispose`,
6
- * but {@link useEffect} only invokes it when dependencies change — never when
7
- * the element leaves the DOM. Left alone, every `useObservable` /
8
- * `useObservableValues` / `useEffect` subscription leaks on unmount and keeps
9
- * firing `requestUpdate` on a detached element. `useConnected` is likewise
10
- * inert because nothing dispatches the `"connected"` / `"disconnected"`
11
- * events it listens for.
6
+ * A hook host has two kinds of slot:
12
7
  *
13
- * This installs a single Lit {@link ReactiveController} — the one hook-friendly
14
- * path to a genuine `hostDisconnected` — that:
15
- * - on disconnect, *schedules* (on a microtask) dispatching `"disconnected"`,
16
- * disposing every hook slot, and clearing the cursor (full unmount semantics);
17
- * - on connect, if a teardown is still pending it CANCELS it (the disconnect
18
- * was half of a DOM move — hooks are intact, so nothing re-subscribes and no
19
- * re-render is forced); otherwise it dispatches `"connected"` and, on a true
20
- * reconnect, forces a re-render so the torn-down hooks re-initialize.
8
+ * - **Value / subscription slots** — {@link useState}, {@link useRef},
9
+ * {@link useMemo}, and effect-backed subscriptions ({@link useEffect},
10
+ * {@link useObservable}, {@link useObservableValues}). These are *stateful*
11
+ * and *expensive to rebuild*. They must SURVIVE a DOM move and be finalized
12
+ * only when the element is genuinely gone.
13
+ * - **Connectedness edges** — {@link useConnected}, the primitive for window /
14
+ * document listeners, portals, drag sessions: things that track raw DOM
15
+ * connectedness and must attach/detach *synchronously* on every edge.
21
16
  *
22
- * ## Why disposal is deferred
17
+ * The trap: the DOM fires `disconnectedCallback` then `connectedCallback`
18
+ * **synchronously, in the same task,** whenever a connected element is merely
19
+ * *moved* (a Lit `repeat` reorder, a list re-parenting, a drag-reorder). There
20
+ * is no synchronous signal that distinguishes a move from a genuine unmount, so
21
+ * this controller does not try to classify the edge. Instead it handles each
22
+ * concern with the policy that concern actually wants:
23
23
  *
24
- * The DOM fires `disconnectedCallback` then `connectedCallback` **synchronously,
25
- * in the same task,** whenever a connected element is merely *moved* — a Lit
26
- * `repeat` reorder, a list re-parenting, a drag-reorder. Disposing inline would
27
- * tear down and rebuild every subscription (re-running uncached producers) plus
28
- * force a re-render on every such move, with the hook state momentarily reset —
29
- * the studio-page lag, refresh churn, and transient empty lists on project
30
- * switch (FFP-111900). Deferring teardown one microtask lets a synchronous
31
- * reconnect distinguish a move (cancel) from a genuine unmount (let it run), so
32
- * a move is a no-op and only a real unmount disposes. A late reconnect (a
33
- * different task) is treated as unmount+remount, which is correct.
24
+ * - **Edges fire synchronously, every time.** `hostConnected` /
25
+ * `hostDisconnected` dispatch the `"connected"` / `"disconnected"` events
26
+ * inline on every raw edge, so {@link useConnected} tears down and re-attaches
27
+ * deterministically — including across a move (cheap, and exactly what a
28
+ * listener/portal wants).
29
+ * - **Slot finalization is deferred behind an `isConnected` re-check.** A
30
+ * disconnect schedules a microtask; when it runs it disposes the slots only
31
+ * if the host is STILL disconnected. A move has reconnected by then, so its
32
+ * slots survive untouched — no re-subscribe, no state reset, no forced
33
+ * re-render. A genuine unmount is still disconnected, so it finalizes,
34
+ * preserving the unmount-leak fix.
35
+ *
36
+ * On a reconnect after a genuine finalization, the slots are empty, so the
37
+ * controller forces one `requestUpdate` to re-initialize them.
34
38
  *
35
39
  * It is installed lazily from inside the wrapped `render` (see {@link withHooks}),
36
40
  * which runs after `connectedCallback`, so `addController` fires `hostConnected`
@@ -9,58 +9,57 @@ function isReactiveHost(host) {
9
9
  return "addController" in host && typeof host.addController === "function";
10
10
  }
11
11
  /**
12
- * Dispose every effect-style hook slot and reset the hook cursor so the next
13
- * render re-initializes hooks from scratch. Only slots that expose a
14
- * `dispose` function (effects, subscriptions) are torn down; value slots
15
- * (state, memo, ref) are simply dropped.
12
+ * Finalize a host: dispose every hook slot's cleanup and clear the slots so the
13
+ * next render re-initializes from scratch. Only slots that expose a `dispose`
14
+ * function (effects, subscriptions) are torn down; value slots (state, memo,
15
+ * ref) are simply dropped.
16
16
  */
17
- function disposeHooks(host) {
17
+ function finalizeHooks(host) {
18
18
  const { hooks } = host;
19
19
  if (hooks) {
20
20
  for (const hook of hooks) {
21
21
  hook?.dispose?.();
22
22
  }
23
23
  }
24
- // Invariant: every live subscription (useEffect / useObservable / ...) exposes a
25
- // `dispose` and is torn down in the loop above, so nothing should fire after this.
26
- // A useState setter closure that still runs post-disconnect would write into the
27
- // emptied array and requestUpdate a detached host. That signals an un-torn-down
28
- // subscription (a bug at the subscription site), not something to guard here.
29
24
  host.hooks = [];
30
25
  host.hookIndex = 0;
31
26
  }
32
27
  /**
33
- * Give a hook host a real disconnect edge.
28
+ * Give a hook host a correct lifecycle by separating two concerns that the DOM
29
+ * connect/disconnect edge conflates.
34
30
  *
35
- * The hook model stores every effect's cleanup in `host.hooks[i].dispose`,
36
- * but {@link useEffect} only invokes it when dependencies change — never when
37
- * the element leaves the DOM. Left alone, every `useObservable` /
38
- * `useObservableValues` / `useEffect` subscription leaks on unmount and keeps
39
- * firing `requestUpdate` on a detached element. `useConnected` is likewise
40
- * inert because nothing dispatches the `"connected"` / `"disconnected"`
41
- * events it listens for.
31
+ * A hook host has two kinds of slot:
42
32
  *
43
- * This installs a single Lit {@link ReactiveController} — the one hook-friendly
44
- * path to a genuine `hostDisconnected` — that:
45
- * - on disconnect, *schedules* (on a microtask) dispatching `"disconnected"`,
46
- * disposing every hook slot, and clearing the cursor (full unmount semantics);
47
- * - on connect, if a teardown is still pending it CANCELS it (the disconnect
48
- * was half of a DOM move — hooks are intact, so nothing re-subscribes and no
49
- * re-render is forced); otherwise it dispatches `"connected"` and, on a true
50
- * reconnect, forces a re-render so the torn-down hooks re-initialize.
33
+ * - **Value / subscription slots** — {@link useState}, {@link useRef},
34
+ * {@link useMemo}, and effect-backed subscriptions ({@link useEffect},
35
+ * {@link useObservable}, {@link useObservableValues}). These are *stateful*
36
+ * and *expensive to rebuild*. They must SURVIVE a DOM move and be finalized
37
+ * only when the element is genuinely gone.
38
+ * - **Connectedness edges** — {@link useConnected}, the primitive for window /
39
+ * document listeners, portals, drag sessions: things that track raw DOM
40
+ * connectedness and must attach/detach *synchronously* on every edge.
51
41
  *
52
- * ## Why disposal is deferred
42
+ * The trap: the DOM fires `disconnectedCallback` then `connectedCallback`
43
+ * **synchronously, in the same task,** whenever a connected element is merely
44
+ * *moved* (a Lit `repeat` reorder, a list re-parenting, a drag-reorder). There
45
+ * is no synchronous signal that distinguishes a move from a genuine unmount, so
46
+ * this controller does not try to classify the edge. Instead it handles each
47
+ * concern with the policy that concern actually wants:
53
48
  *
54
- * The DOM fires `disconnectedCallback` then `connectedCallback` **synchronously,
55
- * in the same task,** whenever a connected element is merely *moved* — a Lit
56
- * `repeat` reorder, a list re-parenting, a drag-reorder. Disposing inline would
57
- * tear down and rebuild every subscription (re-running uncached producers) plus
58
- * force a re-render on every such move, with the hook state momentarily reset —
59
- * the studio-page lag, refresh churn, and transient empty lists on project
60
- * switch (FFP-111900). Deferring teardown one microtask lets a synchronous
61
- * reconnect distinguish a move (cancel) from a genuine unmount (let it run), so
62
- * a move is a no-op and only a real unmount disposes. A late reconnect (a
63
- * different task) is treated as unmount+remount, which is correct.
49
+ * - **Edges fire synchronously, every time.** `hostConnected` /
50
+ * `hostDisconnected` dispatch the `"connected"` / `"disconnected"` events
51
+ * inline on every raw edge, so {@link useConnected} tears down and re-attaches
52
+ * deterministically — including across a move (cheap, and exactly what a
53
+ * listener/portal wants).
54
+ * - **Slot finalization is deferred behind an `isConnected` re-check.** A
55
+ * disconnect schedules a microtask; when it runs it disposes the slots only
56
+ * if the host is STILL disconnected. A move has reconnected by then, so its
57
+ * slots survive untouched — no re-subscribe, no state reset, no forced
58
+ * re-render. A genuine unmount is still disconnected, so it finalizes,
59
+ * preserving the unmount-leak fix.
60
+ *
61
+ * On a reconnect after a genuine finalization, the slots are empty, so the
62
+ * controller forces one `requestUpdate` to re-initialize them.
64
63
  *
65
64
  * It is installed lazily from inside the wrapped `render` (see {@link withHooks}),
66
65
  * which runs after `connectedCallback`, so `addController` fires `hostConnected`
@@ -77,42 +76,44 @@ export function installHooksController(host) {
77
76
  // addController fires hostConnected synchronously, and setting the flag first
78
77
  // guards against a re-entrant render re-installing a duplicate controller.
79
78
  host[HOOKS_CONTROLLER] = true;
80
- let connectedOnce = false;
81
- // True between a disconnect and its scheduled teardown. A reconnect that sees
82
- // this flag set is the tail of a move and cancels the teardown.
83
- let pendingDisposal = false;
79
+ // The slots were finalized (disposed + cleared) while the host was detached,
80
+ // so the next connect must re-render to re-initialize and re-subscribe them.
81
+ let finalized = false;
82
+ // A finalization microtask is already queued; don't queue a second.
83
+ let finalizationQueued = false;
84
84
  const controller = {
85
85
  hostConnected() {
86
- if (pendingDisposal) {
87
- // Tail of a MOVE: the just-fired disconnect scheduled a teardown that
88
- // has not run yet. Cancel it — the hooks are untouched, so there is
89
- // nothing to re-subscribe and no reason to force a re-render.
90
- pendingDisposal = false;
91
- return;
92
- }
93
- // The "connected" / "disconnected" events are for EXTERNAL listeners only.
94
- // The internal useConnected does NOT depend on them: this fires before the
95
- // render body attaches any listener, so useConnected is driven by its direct
96
- // isConnected check plus useEffect cleanup instead.
86
+ // Fire the connect edge synchronously on EVERY connect (mount / move /
87
+ // remount) so edge hooks (useConnected) run their setup deterministically.
97
88
  host.dispatchEvent(new Event("connected"));
98
- if (connectedOnce) {
99
- // Reconnect: the previous disconnect disposed and cleared every
100
- // hook slot, so re-render to re-run hooks and re-subscribe.
89
+ if (finalized) {
90
+ // The host was fully finalized while detached (a genuine unmount): its
91
+ // slots are empty, so re-render to re-initialize and re-subscribe them.
92
+ finalized = false;
101
93
  host.requestUpdate();
102
94
  }
103
- connectedOnce = true;
104
95
  },
105
96
  hostDisconnected() {
106
- // Defer teardown one microtask so a synchronous reconnect (a DOM move)
107
- // can cancel it above. Only a genuine unmount reaches the callback.
108
- pendingDisposal = true;
97
+ // Fire the disconnect edge synchronously on EVERY disconnect (unmount /
98
+ // move) so edge hooks tear down synchronously.
99
+ host.dispatchEvent(new Event("disconnected"));
100
+ // Defer slot finalization behind an isConnected re-check: a DOM move has
101
+ // reconnected by the time the microtask runs, so its value/subscription
102
+ // slots survive untouched; only a genuine unmount (still detached) is
103
+ // finalized. This is what keeps a move from churning subscriptions while
104
+ // still disposing them on a real unmount.
105
+ if (finalizationQueued) {
106
+ return;
107
+ }
108
+ finalizationQueued = true;
109
109
  queueMicrotask(() => {
110
- if (!pendingDisposal) {
110
+ finalizationQueued = false;
111
+ if (host.isConnected) {
112
+ // Moved / reconnected within the task — keep every slot alive.
111
113
  return;
112
114
  }
113
- pendingDisposal = false;
114
- host.dispatchEvent(new Event("disconnected"));
115
- disposeHooks(host);
115
+ finalizeHooks(host);
116
+ finalized = true;
116
117
  });
117
118
  },
118
119
  };
@@ -1 +1 @@
1
- {"version":3,"file":"hooks-controller.js","sourceRoot":"","sources":["../../../src/hooks/component/hooks-controller.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAKvD;;;;GAIG;AACH,MAAM,gBAAgB,GAAG,MAAM,CAAC,0BAA0B,CAAC,CAAC;AAI5D,SAAS,cAAc,CAAC,IAAe;IACnC,OAAO,eAAe,IAAI,IAAI,IAAI,OAAO,IAAI,CAAC,aAAa,KAAK,UAAU,CAAC;AAC/E,CAAC;AAED;;;;;GAKG;AACH,SAAS,YAAY,CAAC,IAAe;IACjC,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IACvB,IAAI,KAAK,EAAE,CAAC;QACR,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACtB,IAA6C,EAAE,OAAO,EAAE,EAAE,CAAC;QAChE,CAAC;IACL,CAAC;IACD,iFAAiF;IACjF,mFAAmF;IACnF,iFAAiF;I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cAAc,CAAC,CAAC,CAAC;gBAC9C,YAAY,CAAC,IAAI,CAAC,CAAC;YACvB,CAAC,CAAC,CAAC;QACP,CAAC;KACJ,CAAC;IACF,IAAI,CAAC;QACD,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IACnC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,4EAA4E;QAC5E,2EAA2E;QAC3E,IAAI,CAAC,gBAAgB,CAAC,GAAG,SAAS,CAAC;QACnC,MAAM,KAAK,CAAC;IAChB,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"hooks-controller.js","sourceRoot":"","sources":["../../../src/hooks/component/hooks-controller.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAKvD;;;;GAIG;AACH,MAAM,gBAAgB,GAAG,MAAM,CAAC,0BAA0B,CAAC,CAAC;AAI5D,SAAS,cAAc,CAAC,IAAe;IACnC,OAAO,eAAe,IAAI,IAAI,IAAI,OAAO,IAAI,CAAC,aAAa,KAAK,UAAU,CAAC;AAC/E,CAAC;AAED;;;;;GAKG;AACH,SAAS,aAAa,CAAC,IAAe;IAClC,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IACvB,IAAI,KAAK,EAAE,CAAC;QACR,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACtB,IAA6C,EAAE,OAAO,EAAE,EAAE,CAAC;QAChE,CAAC;IACL,CAAC;IACD,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;IAChB,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;AACvB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAAe;IAClD,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC;QAClD,OAAO;IACX,CAAC;IACD,0EAA0E;IAC1E,8EAA8E;IAC9E,2EAA2E;IAC3E,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AAC"}
@@ -4,8 +4,10 @@ import { installHooksController } from "./hooks-controller.js";
4
4
  /**
5
5
  * Minimal stand-in for a Lit host: an EventTarget that captures the controller
6
6
  * installed on it so the test can drive `hostConnected` / `hostDisconnected`
7
- * directly (a real Lit element would need a DOM). `addController` mirrors Lit's
8
- * contract of firing `hostConnected` synchronously when already connected.
7
+ * directly (a real Lit element would need a DOM). `connect()` / `disconnect()`
8
+ * flip `isConnected` BEFORE dispatching, mirroring the DOM (the callback runs
9
+ * after connectedness has already changed) — the controller's deferred
10
+ * finalization reads `isConnected` to tell a move from a genuine unmount.
9
11
  */
10
12
  class FakeHost extends EventTarget {
11
13
  constructor() {
@@ -20,20 +22,21 @@ class FakeHost extends EventTarget {
20
22
  addController(controller) {
21
23
  this.controllers.push(controller);
22
24
  }
23
- // Simulate Lit dispatching lifecycle to every registered controller.
24
25
  connect() {
26
+ this.isConnected = true;
25
27
  for (const c of this.controllers)
26
28
  c.hostConnected?.();
27
29
  }
28
30
  disconnect() {
31
+ this.isConnected = false;
29
32
  for (const c of this.controllers)
30
33
  c.hostDisconnected?.();
31
34
  }
32
35
  }
33
- /** Resolves after the current microtask checkpoint, so deferred teardown can run. */
36
+ /** Resolves after the current microtask checkpoint, so deferred finalization can run. */
34
37
  const flushMicrotasks = () => new Promise(resolve => queueMicrotask(resolve));
35
38
  describe("installHooksController", () => {
36
- it("disposes every effect hook and resets the cursor on a genuine disconnect", async () => {
39
+ it("finalizes every effect hook and resets the cursor on a genuine disconnect", async () => {
37
40
  const host = new FakeHost();
38
41
  const disposeA = vi.fn();
39
42
  const disposeB = vi.fn();
@@ -46,52 +49,82 @@ describe("installHooksController", () => {
46
49
  host.hookIndex = 4;
47
50
  installHooksController(host);
48
51
  host.disconnect();
49
- // Teardown is deferred one microtask (so a move can cancel it); with no
50
- // reconnect this is a real unmount, so it runs on the next checkpoint.
52
+ // Finalization is deferred one microtask (so a move can cancel it); with no
53
+ // reconnect the host is still disconnected, so it runs on the next checkpoint.
51
54
  await flushMicrotasks();
52
55
  expect(disposeA).toHaveBeenCalledTimes(1);
53
56
  expect(disposeB).toHaveBeenCalledTimes(1);
54
57
  expect(host.hooks).toEqual([]);
55
58
  expect(host.hookIndex).toBe(0);
56
59
  });
57
- it("a synchronous disconnect→reconnect (a MOVE) cancels teardown and forces no re-render", async () => {
60
+ it("fires the connect / disconnect EDGE synchronously — no microtask needed", () => {
61
+ const host = new FakeHost();
62
+ const onConnected = vi.fn();
63
+ const onDisconnected = vi.fn();
64
+ host.addEventListener("connected", onConnected);
65
+ host.addEventListener("disconnected", onDisconnected);
66
+ installHooksController(host);
67
+ host.connect();
68
+ expect(onConnected).toHaveBeenCalledTimes(1);
69
+ host.disconnect();
70
+ // No flush: the edge is synchronous so connectedness hooks (useConnected)
71
+ // tear down inline. Under the old defer-everything controller this event
72
+ // only fired on a later microtask.
73
+ expect(onDisconnected).toHaveBeenCalledTimes(1);
74
+ });
75
+ it("fires disconnect THEN connect synchronously across a MOVE, and does NOT finalize", async () => {
58
76
  const host = new FakeHost();
59
77
  const dispose = vi.fn();
60
78
  host.hooks = [{ dispose, dependencies: [] }];
61
79
  host.hookIndex = 1;
80
+ const edges = [];
81
+ host.addEventListener("disconnected", () => edges.push("disconnect"));
82
+ host.addEventListener("connected", () => edges.push("connect"));
62
83
  installHooksController(host);
63
- host.connect(); // first mount
64
84
  host.requestUpdate.mockClear();
65
- // Disconnect immediately followed by reconnect, same task — a DOM move.
85
+ // Move: disconnect immediately followed by reconnect, same task.
66
86
  host.disconnect();
67
87
  host.connect();
88
+ expect(edges).toEqual(["disconnect", "connect"]); // both edges, synchronous, in order
68
89
  await flushMicrotasks();
69
- // Nothing was torn down and no re-render was forced: the hooks survived.
90
+ // The slot survived: not disposed, and no re-render was forced.
70
91
  expect(dispose).not.toHaveBeenCalled();
71
92
  expect(host.hooks).toHaveLength(1);
72
93
  expect(host.requestUpdate).not.toHaveBeenCalled();
73
94
  });
74
- it("dispatches connected / disconnected events across the lifecycle", async () => {
95
+ it("a rapid disconnect→connect→disconnect bounce finalizes exactly once (net state wins)", async () => {
75
96
  const host = new FakeHost();
76
- const onConnected = vi.fn();
77
- const onDisconnected = vi.fn();
78
- host.addEventListener("connected", onConnected);
79
- host.addEventListener("disconnected", onDisconnected);
97
+ const dispose = vi.fn();
98
+ host.hooks = [{ dispose, dependencies: [] }];
80
99
  installHooksController(host);
100
+ // Bounce within one task: only one finalization microtask is queued, and it
101
+ // reads the final isConnected (false) → finalizes once, not per disconnect.
102
+ host.disconnect();
81
103
  host.connect();
82
- expect(onConnected).toHaveBeenCalledTimes(1);
83
104
  host.disconnect();
84
105
  await flushMicrotasks();
85
- expect(onDisconnected).toHaveBeenCalledTimes(1);
106
+ expect(dispose).toHaveBeenCalledTimes(1);
107
+ expect(host.hooks).toEqual([]);
108
+ });
109
+ it("gates finalization on isConnected — a slot that reconnects before the microtask survives", async () => {
110
+ const host = new FakeHost();
111
+ const dispose = vi.fn();
112
+ host.hooks = [{ dispose, dependencies: [] }];
113
+ installHooksController(host);
114
+ host.disconnect(); // schedules finalization; isConnected now false
115
+ host.connect(); // reconnects in the same task; isConnected back to true
116
+ await flushMicrotasks();
117
+ expect(dispose).not.toHaveBeenCalled();
118
+ expect(host.hooks).toHaveLength(1);
86
119
  });
87
- it("forces a re-render only on a genuine RE-connect, not the first connect", async () => {
120
+ it("forces a re-render only on a genuine RE-connect, not the first connect or a move", async () => {
88
121
  const host = new FakeHost();
89
122
  installHooksController(host);
90
123
  host.connect(); // first mount
91
124
  expect(host.requestUpdate).not.toHaveBeenCalled();
92
125
  host.disconnect();
93
- await flushMicrotasks(); // genuine unmount: teardown runs
94
- host.connect(); // reconnect re-initializes the torn-down hooks
126
+ await flushMicrotasks(); // genuine unmount: finalization runs
127
+ host.connect(); // reconnect must re-initialize the finalized hooks
95
128
  expect(host.requestUpdate).toHaveBeenCalledTimes(1);
96
129
  });
97
130
  it("is idempotent — repeated installs register a single controller", () => {
@@ -1 +1 @@
1
- {"version":3,"file":"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