-
Notifications
You must be signed in to change notification settings - Fork 8
update: support storybook 9 #30
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
base: main
Are you sure you want to change the base?
Conversation
@JohnAlbin that time of year again, this adds storybook 9 support, it introduces backwards incompatible changes so best to update readme & bump version. |
dd06071
to
57ddfdf
Compare
sorry for GitHub actions noise. I updated the dependencies as well in https://github.com/chr33s/storybook-addon-fetch-mock/tree/update . Opted to keep it separate to not pollute this pr's purpose. |
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.
Pull Request Overview
This PR updates the storybook-addon-fetch-mock library to support Storybook 9, involving significant API changes and modernization of the codebase.
- Updates fetch-mock API calls to use new v12 syntax (route() instead of mock(), hardReset() instead of reset())
- Migrates from legacy Storybook imports to new v9 internal module structure
- Modernizes build tooling with Vite configuration and ESLint flat config
Reviewed Changes
Copilot reviewed 11 out of 14 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
package.json | Updates dependencies to Storybook 9 and fetch-mock 12, changes package name and repository |
src/withFetchMock.ts | Updates fetch-mock API calls and import paths for Storybook 9 compatibility |
src/preview.ts | Updates Storybook type imports to use internal module paths |
eslint.config.js | Migrates from legacy .eslintrc.cjs to modern flat config format |
.storybook/main.ts | Adds Storybook configuration for testing the addon |
tests/ | Adds test components and stories to verify addon functionality |
vite.config.ts | Adds Vite configuration for modern build tooling |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
fetchMock.callHistory.calls().forEach((call) => { | ||
calls[call.url] = call; |
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.
Using call.url
as the object key could cause collisions if multiple calls are made to the same URL. The original code used call.identifier
which would be unique. Consider using a combination of URL and index or timestamp to ensure uniqueness.
fetchMock.callHistory.calls().forEach((call) => { | |
calls[call.url] = call; | |
fetchMock.callHistory.calls().forEach((call, i) => { | |
const key = call.identifier ? call.identifier : `${call.url}-${i}`; | |
calls[key] = call; |
Copilot uses AI. Check for mistakes.
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.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
I fully sympathise with the situation that the @JohnAlbin finds himself in and so am asking this as gently as possible; @chr33s, do you have any idea when this might be merged? I've just upgraded to v9 and this has become the proverbial "fly in the ointment". |
closes: #30944