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 broken setup stories #3896

Merged
merged 4 commits into from
May 16, 2023
Merged

Fix broken setup stories #3896

merged 4 commits into from
May 16, 2023

Conversation

julieg18
Copy link
Contributor

Noticed while working on #3895 that our setup stories were broken

Leftover from #3851

@julieg18 julieg18 self-assigned this May 15, 2023
@julieg18 julieg18 marked this pull request as ready for review May 15, 2023 16:07
@julieg18 julieg18 requested review from mattseddon and sroy3 as code owners May 15, 2023 16:07
@@ -42,7 +56,13 @@ export default {
} as Meta

const Template: StoryFn = ({ data }) => {
const app = <App />
const app = (
<Provider store={configureStore({ reducer: setupReducers })}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can pass a preloaded state here instead of using dispatch and feeding the store like you currently do. The good part about this is that the story is ready on the get-go, it's not going to change while the store is being fed. Also, you won't need to export stuff from the webview simply for the story.

<Provider
      store={configureStore({
        preloadedState: { ...data },
        reducer: experimentsReducers
      })}
    >

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On further inspection, we'd need to adjust our DEFAULT_DATA to be configured like our redux state object for us to pass it as our preloadedState. While we could do that, it would make the DEFAULT_DATA harder to adjust with its nested state objects. I'll keep the MockedState component for now to make story creation simpler.

@julieg18 julieg18 enabled auto-merge (squash) May 15, 2023 23:34
@codeclimate
Copy link

codeclimate bot commented May 16, 2023

Code Climate has analyzed commit be33351 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (85% is the threshold).

This pull request will bring the total coverage in the repository to 94.9% (0.0% change).

View more on Code Climate.

@julieg18 julieg18 merged commit 1faf018 into main May 16, 2023
@julieg18 julieg18 deleted the fix-setup-stories branch May 16, 2023 00:15
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.

3 participants