Skip to content

Commit 020b79a

Browse files
docs: state current behavior in MockComponent test comments
Rewrite process/history-narrating comments to describe what the code does now, dropping issue references, the previous-crash narration, and the "rather than a $: block" before/after framing. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent b4c5692 commit 020b79a

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

packages/ui-components/src/__tests__/MockComponent.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,8 @@ test("mirrors the received props (excluding testid) into the shared store", () =
3636
});
3737

3838
test("mounts more than one instance with distinct testids without crashing", () => {
39-
// Reproduces the #1840 scenario: rendering more than one MockComponent in a
40-
// single tree previously threw "RangeError: Invalid array length" from the
41-
// reactive props store feedback loop. Distinct testids let each instance be
42-
// queried individually.
39+
// Rendering more than one MockComponent in a single tree is supported.
40+
// Distinct testids let each instance be queried individually.
4341
render(MockComponentTest);
4442

4543
const first = screen.getByTestId("first");

packages/ui-components/src/lib/__mocks__/MockComponent.svelte

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@
99
1010
// The received props are mirrored into a shared store so tests can assert on
1111
// values (functions, objects) that cannot round-trip through DOM attributes.
12-
// This runs in `afterUpdate` rather than a reactive `$:` block so it never
13-
// re-enters the component's update cycle, which caused the invalid array
14-
// length crash when multiple instances were mounted.
12+
// This runs in `afterUpdate`, so the store write happens outside the
13+
// component's update cycle and does not re-enter it.
1514
afterUpdate(() => {
1615
props.set($$restProps);
1716
});

0 commit comments

Comments
 (0)