Skip to content

Commit

Permalink
Merge pull request #2755 from headlamp-k8s/fix-storybook-crash
Browse files Browse the repository at this point in the history
storybook: Add workaround for the circular dependecy crash
  • Loading branch information
joaquimrocha authored Jan 22, 2025
2 parents 7c13419 + 415d00f commit f47b2a8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions frontend/.storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ import '../src/index.css';
import { Title, Subtitle, Description, Primary, Controls } from '@storybook/blocks';
import { baseMocks } from './baseMocks';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import App from '../src/App';

// App import will load the whole app dependency tree
// And assigning it to a value will make sure it's not tree-shaken and removed
const DontDeleteMe = App;

// https://github.com/mswjs/msw-storybook-addon
initialize({
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/components/gateway/ClassDetails.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ export default {
'http://localhost:4466/apis/gateway.networking.k8s.io/v1beta1/gatewayclasses',
() => HttpResponse.error()
),
http.get(
'http://localhost:4466/apis/gateway.networking.k8s.io/v1beta1/gatewayclasses',
() => HttpResponse.error()
),
http.get('http://localhost:4466/api/v1/namespaces/default/events', () =>
HttpResponse.json({
kind: 'EventList',
Expand Down
1 change: 1 addition & 0 deletions frontend/src/storybook.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const options = {
vi.mock('@iconify/react', () => ({
Icon: () => null,
InlineIcon: () => null,
addCollection: () => {},
}));

vi.mock('@monaco-editor/react', () => ({
Expand Down

0 comments on commit f47b2a8

Please sign in to comment.