Skip to content

Make initial values of observable set accept readonly array #2202

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

Merged
merged 1 commit into from
Dec 14, 2019
Merged

Make initial values of observable set accept readonly array #2202

merged 1 commit into from
Dec 14, 2019

Conversation

upsuper
Copy link
Contributor

@upsuper upsuper commented Nov 12, 2019

ObservableSet doesn't need to change the initial values array, so it makes sense to allow passing in a readonly one.

@upsuper
Copy link
Contributor Author

upsuper commented Nov 18, 2019

@FredyC Not quite sure about your process. Are you going to merge this PR?

@danielkcz
Copy link
Contributor

Well, the process generally is that someone approves and other maintainer merges.

I am curious how did you even discover such an "issue"? Why does it bother you? :)

@upsuper
Copy link
Contributor Author

upsuper commented Nov 19, 2019

Well, the process generally is that someone approves and other maintainer merges.

Oh, okay, thanks for the update.

I am curious how did you even discover such an "issue"? Why does it bother you? :)

So, we try to use .replace() to update an ObservableSet, but with a readonly array returned from some other function. And TypeScript complains about it. We currently work around this issue via set.replace([...readonlyArray]) which seems to be pointless.

@ItamarShDev
Copy link
Member

I can merge @FredyC

@upsuper
Copy link
Contributor Author

upsuper commented Dec 9, 2019

Ping on this? @ItamarShDev could you merge?

@danielkcz danielkcz merged commit ae2596b into mobxjs:master Dec 14, 2019
@upsuper upsuper deleted the set-initial-readonly branch December 14, 2019 08:26
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