mirror of https://github.com/sveltejs/svelte
We need to use `deep_read` to traverse all properties of an object inside legacy mode and inside actions, because the input we get could be a state proxy. This proxy will have fine-grained reactivity and therefore only update the signal at the location that got an update. In order to have interop with the coarse-grained "notify me when _anything_ in that object changes" behavior, we need to setup up signals for all of the object's properties before they're potentially mutated.
This has a lot of overhead for large lists, and we can at least diminish in the "no state proxy" case by applying a sensible heuristic: - If the value passed is a state proxy, read it - If not, and if the value is an array, then bail because an array of state proxies is highly unlikely - Traverse the first level of properties of the object and look if these are state, if not bail. State proxies nested further down are highly unlikely, too part of #10637pull/10654/head
parent
77b1f2fe51
commit
1e59989eb4
@ -0,0 +1,5 @@
|
||||
---
|
||||
"svelte": patch
|
||||
---
|
||||
|
||||
perf: bail early when traversing non-state
|
||||
Loading…
Reference in new issue