-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Description
Describe the bug
Wrapping an existing Proxy with a $state and then modifying the new object doesn't trigger the inner Proxy.
I'm aware that under the hood $state is also a Proxy which might explain lots of things, but from what I've seen nested proxies are possible.
Reproduction
Code:
<svelte:options runes />
<script>
const proxyHandler = {
get(target, key) {
return target[key];
},
set(target, key, value) {
target[key] = "NOT_GETTING_SET";
return true;
}
}
const reactive = $state(new Proxy({1:"hello",2:"world"}, proxyHandler))
const nonReactive = new Proxy({1:"hello",2:"world"}, proxyHandler)
reactive[1] = "a"
console.log(reactive[1])
nonReactive[1] = "a"
console.log(nonReactive[1])
</script>
Logs
No response
System Info
Context same as replSeverity
annoyance
Metadata
Metadata
Assignees
Labels
No labels