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(nova-react-test-utils): fix issue with store being shared between stories #118

Conversation

sjwilczynski
Copy link
Contributor

@sjwilczynski sjwilczynski commented Oct 1, 2024

As we discovered when integrating new decorator in 1JS, there is a problem with passing relay environment config to the decorator. The issue is that when one used as in docs getNovaDecorator(schema, { store: createStores() }) that would cause a store to be shared between multiple stories as createStore function was executed once for the whole decorator. This means that we cannot just pass relay env options directly instead we change the code to pass function that gets the options.

Tested using storybook and verifying each has unique data in store and results of resolvers don't not slip over. Theoretically it is a breaking change but as the option was not yet widely used, we mark it as minor.

Special thanks to @jakobkhansen for reporting and creating repro of the issue in https://github.com/jakobkhansen/nova-facade/tree/user/jakobhansen/sharedstore_repro

@sjwilczynski sjwilczynski enabled auto-merge (squash) October 1, 2024 14:27
@sjwilczynski sjwilczynski merged commit 0ff8fb4 into microsoft:main Oct 3, 2024
2 checks passed
@sjwilczynski sjwilczynski deleted the user/stwilczy/fixIssueWithSharedStore branch October 3, 2024 12:08
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.

3 participants