-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
View is not updated after change Array inside Object #2290
Comments
I think this is related to #2243. |
If there's an actual assignment, this should work. It looks like the compiler is inserting the correct calls to |
Yep, the
From the code: svelte/src/compile/render-dom/wrappers/shared/Tag.ts Lines 35 to 39 in d637211
The svelte/src/compile/nodes/shared/Tag.ts Lines 12 to 15 in d637211
|
I used an array myself that i needed to know whenever it was changed by an external non-svelte lib and i did not want to allocate a new copy of the huge array for performance reason. so i came up with a own proxy observer that dose something like this function observer(target, fn) {
return new Proxy(target, {
apply: (...args) => Reflect.apply(...args, fn()),
deleteProperty: (...args) => Reflect.deleteProperty(...args, fn()),
set: (...args) => Reflect.set(...args, fn()),
})
}
let dataset = observer(
[], // the source, could be a object also
() => dataset = dataset // override \w same to let svelte know
); This will still let ju use push, slice, etc... |
(version: 3.0.0-beta.20)
This is not update the view:
See repl
How can I update the view manually?
The text was updated successfully, but these errors were encountered: