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: share internal symbols between immer installations #323

Merged
merged 1 commit into from
Mar 5, 2019

Conversation

aleclarson
Copy link
Member

This uses Symbol.for when creating the DRAFTABLE and DRAFT_STATE symbols, so that separate installations of Immer can work together.

Note: The nothing symbol is still not portable across installations, since it never escapes any producer that returns it. The only reason this could be an issue is if an Immer-using library transparently wraps a user's function and asks them to install their own copy of Immer if they want to return nothing (in that case, the library should instead re-export nothing for its users).

This repro shows this PR working as expected:
https://github.com/aleclarson/repro/tree/portable-immer

Fixes #322

The `nothing` symbol is still not portable across installations, since it never escapes any producer that returns it. The only reason this could be an issue is if an Immer-using library transparently wraps a user's function and asks them to install their own copy of Immer if they want to return `nothing` (in that case, the library should instead re-export `nothing` for its users).

Fixes #322
@coveralls
Copy link

Coverage Status

Coverage remained the same at 99.733% when pulling d71a1fe on symbols into fad74d3 on master.

@aleclarson aleclarson merged commit 02fed2c into master Mar 5, 2019
@aleclarson
Copy link
Member Author

🎉 This PR is included in version 2.1.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@aleclarson aleclarson deleted the symbols branch April 18, 2019 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants