Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue: Not unmounting after test causes failures when running multiple tests with a shared decorator. Running the test on its own passes.
Possibly a decorator running causes a tested React component to re-render. If that decorator changes the underlying data assumptions of said component, problems arise.
What I did
Fix #2417 which I reported several minor versions ago and included more details on.
unmount
after finished with rendered treeHow to test
I have an app which this fixes. I could potentially come up with a smaller reproducing app if there are doubts about what this change does.
In my case, the decorator resets my Redux state; each story adds the data its component depends on. (Maybe not an expected use of Storybook but I find it a great way to get a lot of integration testing of reducers+selectors+containers along with presentational components.)
I was getting failures from a random component (always the same one so long as the stories don't change) because its data was wiped away by the decorator's reset and it tried to re-render.
Is this testable with jest or storyshots?
Possibly with jest mock function, counting number of times it is called.
Does this need a new example in the kitchen sink apps?
I don't know.
Does this need an update to the documentation?
I don't think so.
If your answer is yes to any of these, please make sure to include it in your PR.