-
Notifications
You must be signed in to change notification settings - Fork 962
chore: fix storybook flakes #19366
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
chore: fix storybook flakes #19366
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not so sure what the reactRouterOutlet
change does, but the removal of random data inputs and randomized workspace names both seem reasonable to me 👍
I'd like a +1 from @aslilac before merge.
taking a look now |
data: Array.from({ length: 30 }).map((_, i) => { | ||
const date = new Date(2024, 0, i + 1); | ||
return { | ||
date: date.toISOString().split("T")[0], | ||
amount: 5 + Math.floor(Math.random() * 15), | ||
}; | ||
}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you for just unrolling this loop. 😄 this implementation was clever but is far less understandable at a glance, despite being like 1/3rd the lines of code.
@@ -6,6 +7,9 @@ import { | |||
} from "unique-names-generator"; | |||
|
|||
export const generateWorkspaceName = () => { | |||
if (isChromatic()) { | |||
return "chromatic-workspace"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea of just returning a constant here, but could it still be one of our actual random names just for fun?
I just got "yellow-bird-23" as a suggestion which is pretty cute 😌
reactRouterParameters, | ||
} from "storybook-addon-remix-react-router"; | ||
import { WorkspaceSettingsLayout } from "../WorkspaceSettingsLayout"; | ||
import WorkspaceSchedulePage from "./WorkspaceSchedulePage"; | ||
|
||
const meta = { | ||
title: "pages/WorkspaceSchedulePage", | ||
component: WorkspaceSchedulePage, | ||
component: WorkspaceSettingsLayout, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer that this component
stay "correct", but the way the react-router storybook addon works really confuses me, so I don't really have a better idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Me too. The issue was, when using the nested layout function, the react-router decorator was load before any other local decorators, because of how we set it in the preview config, injecting the workspace settings layout before the dashboard provider that is required to make the it work.
IMO, we should simplify the global decorators and let the stories define what they want to use. Improving performance and make easier to identify the story dependencies.
Close #19365