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 Set interceptors #4528

Merged
merged 3 commits into from
Mar 17, 2025
Merged

Fix Set interceptors #4528

merged 3 commits into from
Mar 17, 2025

Conversation

k-g-a
Copy link
Member

@k-g-a k-g-a commented Feb 19, 2025

Code change checklist

  • Added/updated unit tests
  • Updated /docs. For new functionality, at least API.md should be updated
  • Verified that there is no significant performance drop (yarn mobx test:performance)

I'm sorry for the missing related issue.
Just figured out that the newValue returned from the ObservableSet's interceptor is ignored. The following code still uses the base value passed to add() method. At a quick glance, the set() method of the ObservableMap just re-defines the value variable with the change.newValue. So I've reproduced the logic and added coupe of tests.

Sorry, something went wrong.

Copy link

changeset-bot bot commented Feb 19, 2025

🦋 Changeset detected

Latest commit: aa4f5e6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
mobx Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@k-g-a k-g-a changed the title Fix set interceptors Fix Set interceptors Feb 19, 2025
@k-g-a
Copy link
Member Author

k-g-a commented Mar 13, 2025

@urugator / @mweststrate , could you, please, have a look at this PR?

Copy link
Member

@mweststrate mweststrate left a comment

Choose a reason for hiding this comment

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

Looks correct, thanks @k-g-a!

@mweststrate mweststrate merged commit 54e3f71 into main Mar 17, 2025
4 checks passed
@github-actions github-actions bot mentioned this pull request Mar 17, 2025
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.

None yet

2 participants