Skip to content

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

Merged
merged 5 commits into from
Aug 15, 2025
Merged

chore: fix storybook flakes #19366

merged 5 commits into from
Aug 15, 2025

Conversation

BrunoQuaresma
Copy link
Collaborator

Close #19365

@BrunoQuaresma BrunoQuaresma self-assigned this Aug 14, 2025
@BrunoQuaresma BrunoQuaresma requested a review from aslilac as a code owner August 14, 2025 21:52
Copy link
Member

@johnstcn johnstcn left a 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.

@aslilac
Copy link
Member

aslilac commented Aug 15, 2025

taking a look now

Comment on lines -34 to -40
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),
};
}),
Copy link
Member

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";
Copy link
Member

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,
Copy link
Member

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.

Copy link
Collaborator Author

@BrunoQuaresma BrunoQuaresma Aug 15, 2025

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.

@BrunoQuaresma BrunoQuaresma merged commit bed4e12 into main Aug 15, 2025
32 checks passed
@BrunoQuaresma BrunoQuaresma deleted the bq/fix-storybook-flakes-2 branch August 15, 2025 19:07
@github-actions github-actions bot locked and limited conversation to collaborators Aug 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix storybook flakes
3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy