Skip to content

Commit 45f6c11

Browse files
committed
fix test, add comment
1 parent c8b75fa commit 45f6c11

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

packages/svelte/src/legacy/legacy-client.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ class Svelte4Component {
6666
* }} options
6767
*/
6868
constructor(options) {
69+
// Using proxy state here isn't completely mirroring the Svelte 4 behavior, because mutations to a property
70+
// cause fine-grained updates to only the places where that property is used, and not the entire property.
71+
// Reactive statements and actions (the things where this matters) are handling this properly regardless, so it should be fine in practise.
6972
const props = $.proxy({ ...(options.props || {}), $$events: this.#events }, false);
7073
this.#instance = (options.hydrate ? $.hydrate : $.mount)(options.component, {
7174
target: options.target,

packages/svelte/tests/runtime-legacy/samples/binding-backflow/_config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ export default test({
3434

3535
p = parents['reactive_mutate'];
3636
assert.deepEqual(p.value, { foo: 'kid' });
37-
assert.equal(p.updates.length, 1);
37+
assert.equal(p.updates.length, 2);
3838

3939
p = parents['init_update'];
4040
assert.deepEqual(p.value, { foo: 'kid' });
4141
assert.equal(p.updates.length, 2);
4242

4343
p = parents['init_mutate'];
4444
assert.deepEqual(p.value, { foo: 'kid' });
45-
assert.equal(p.updates.length, 1);
45+
assert.equal(p.updates.length, 2);
4646
}
4747
});

0 commit comments

Comments
 (0)