-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Fix array update proxy (important fix) #1985
Conversation
@mweststrate sorry to bother you, but I think it is an important fix that might require a bugfix release (sorry!) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -444,7 +444,7 @@ const arrayExtensions = { | |||
if (hasInterceptors(adm)) { | |||
const change = interceptChange<IArrayWillChange<any>>(adm as any, { | |||
type: "update", | |||
object: this.proxy, | |||
object: adm.proxy as any, // since "this" is the real array we need to pass its proxy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this be tested to make sure it doesn't happen again and to show what it fixed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unit test added
Approved @ItamarShDev, interested in releasing this as a patch on 5.10? Doesn't need a back-port. Invoking Squash merge is probably the clearest in this case Thanks! |
Sure! Will try soon |
Just published it myself since it was taking a bit too long, hope you don't mind |
Apparently my fix to send the array proxy in the update event wasn't ok.
I didn't take into account that "set" is called with the actual proxied array as "this", therefore adm.proxy has to be used instead
Without this fix change.object in array update events is set to "undefined" :-/