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 issues 1980 and 2003 #2058

Merged
merged 5 commits into from
Aug 8, 2019
Merged

fix issues 1980 and 2003 #2058

merged 5 commits into from
Aug 8, 2019

Conversation

haimrait
Copy link
Contributor

Fix issues 1980 and 2003

@danielkcz
Copy link
Contributor

Thanks! Can we perhaps add one more test here for the case @urugator mentioned? Just for sake of everyone :) Make it in a separate commit and I will cherry-pick it to master also.

test/base/map.js Outdated Show resolved Hide resolved
@danielkcz
Copy link
Contributor

danielkcz commented Jul 26, 2019

I am thinking about reverting the merged V5 PR so it's not accidentally published and breaks things. At least until a solution is discovered. Or can you @haimrait prepare a PR with added test and fix?

test/base/map.js Outdated Show resolved Hide resolved
@urugator
Copy link
Collaborator

urugator commented Aug 2, 2019

Good job, if you could add one more test it would be excellent:

test("#1980 .replace should not report changed unnecessarily", () => {
    const mapArray = [["swappedA", "swappedA"], ["swappedB", "swappedB"], ["removed", "removed"]];
    const replacementArray = [mapArray[1], mapArray[0], ["added", "added"]];   
    const map = observable.map(mapArray)        
    let autorunInvocationCount = 0;
    autorun(() => {
      map.get("swappedA");
      map.get("swappedB");
      autorunInvocationCount++;
    });    
    map.replace(replacementArray);
    expect(Array.from(map.entries())).toEqual(replacementArray);
    expect(autorunInvocationCount).toBe(1);
})

@urugator
Copy link
Collaborator

urugator commented Aug 3, 2019

@mweststrate When/if you will have a time, could you take a look whether there is a particular reason for using observable keys array rather than keysAtom in v4?

@mweststrate
Copy link
Member

mweststrate commented Aug 3, 2019 via email

@haimrait
Copy link
Contributor Author

haimrait commented Aug 8, 2019

@urugator @FredyC can we merge this pr?

@danielkcz
Copy link
Contributor

I did not give it a proper thought, but @urugator approved, so let's roll :)

@haimrait Can you please make a second PR for MobX 5 as well?

@danielkcz danielkcz merged commit 97218df into mobxjs:mobx4-master Aug 8, 2019
@haimrait
Copy link
Contributor Author

haimrait commented Aug 9, 2019

sure

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.

4 participants