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

Use Symbol.for to create symbols in the global symbol registry #290

Merged
merged 1 commit into from
Sep 29, 2019
Merged

Use Symbol.for to create symbols in the global symbol registry #290

merged 1 commit into from
Sep 29, 2019

Conversation

ahutchings
Copy link
Collaborator

@ahutchings ahutchings commented Sep 29, 2019

Prior to this change, when using redux-orm across JavaScript contexts (such as iframes and secondary windows), each context will have a unique reference for of the symbol for a key. This was leading to failed symbol checks.

One specific use case this change supports is as follows -

  1. Use redux-orm in a browser window to create ORM state.
  2. Create a selector using an ORM instance as a parameter In a secondary window with its own copy of redux-orm.
  3. Run that selector, passing in the state reference from the primary window.

Without Symbol.for, the isOrmState check in memoize.js fails, resulting in the selector's result function receiving the ORM state instead of the session instance.

Prior to this change, when using redux-orm across JavaScript contexts (such as iframes and secondary windows), each context will have a unique reference for of the symbol for a key. This was leading to failed symbol checks.

One specific use case this change supports is as follows -
1. Use redux-orm in a browser window to create ORM state.
2. Create a selector using an ORM instance as a parameter In a secondary window with its own copy of redux-orm.
3. Run that selector, passing in the state reference from the primary window.

Without Symbol.for, the `isOrmState` check in memoize.js fails, resulting in the selector's result function receiving the ORM state instead of the session instance.
@haveyaseen
Copy link
Member

I think this makes a whole lot of sense. Thanks!

@haveyaseen haveyaseen merged commit db1f15d into redux-orm:master Sep 29, 2019
@ahutchings ahutchings deleted the feature/cross-realm-symbols branch September 29, 2019 19:59
@ahutchings
Copy link
Collaborator Author

Thanks @haveyaseen. Would you mind cutting a new release with this change?

@haveyaseen
Copy link
Member

@ahutchings Released as v0.14.1 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants