Skip to content
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

Merged
merged 4 commits into from
Jun 9, 2019
Merged

Conversation

xaviergonz
Copy link
Contributor

@xaviergonz xaviergonz commented Jun 4, 2019

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" :-/

@xaviergonz xaviergonz changed the title Fix array update proxy Fix array update proxy (important fix) Jun 4, 2019
@xaviergonz xaviergonz requested a review from mweststrate June 4, 2019 18:35
@xaviergonz
Copy link
Contributor Author

@mweststrate sorry to bother you, but I think it is an important fix that might require a bugfix release (sorry!)

@coveralls
Copy link

coveralls commented Jun 4, 2019

Coverage Status

Coverage remained the same at 93.257% when pulling 823670d on fix-array-update-proxy into d8ac621 on master.

Copy link
Contributor

@aretecode aretecode left a 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
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unit test added

@mweststrate
Copy link
Member

mweststrate commented Jun 5, 2019

Approved

@ItamarShDev, interested in releasing this as a patch on 5.10? Doesn't need a back-port. Invoking scripts/publish.sh should do the trick. Let me know your npm name if permissions are lacking :)

Squash merge is probably the clearest in this case

Thanks!

@ItamarShDev
Copy link
Member

Sure! Will try soon
@mweststrate

@xaviergonz xaviergonz merged commit 585c553 into master Jun 9, 2019
@xaviergonz
Copy link
Contributor Author

Just published it myself since it was taking a bit too long, hope you don't mind

@xaviergonz xaviergonz deleted the fix-array-update-proxy branch June 9, 2019 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants