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

[Bug]: Storybook requires restart after adding afterQuery Cell hook #11742

Open
1 task
Philzen opened this issue Dec 4, 2024 · 2 comments
Open
1 task

[Bug]: Storybook requires restart after adding afterQuery Cell hook #11742

Philzen opened this issue Dec 4, 2024 · 2 comments
Labels
bug/needs-info More information is needed for reproduction

Comments

@Philzen
Copy link
Contributor

Philzen commented Dec 4, 2024

How do we reproduce the bug?

Prerequisites:

  • a Cell (complete with mock data and story)
  • a Page that includes that Cell
  1. start storybook yarn rw sb
  2. Call up the page story
  3. add an afterQuery hook to that cell, i.e. export const afterQuery(data) => {console.log('VAPOR LOG MSG'); return data}
  4. story will reload
  5. check the network tab, see the generated code of the mock → it will still contain export const standard = () => mockGraphQLQuery(… instead of export const standard = () => afterQuery(mockGraphQLQuery(…

Reloading (F5) the whole storybook in the browser also won't help.
Same issue when looking at the Cell's success story.

Suggested root cause / fix

Adding an afterQuery hook apparently does not trigger regeneration of the mock file, hence this is probably also the fix.

Side notes

The console shows

Could not Fast Refresh ("afterQuery" export is incompatible). Learn more at https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react#consistent-components-exports

on any change to the afterQuery hook.

the hooks beforeQuery and isEmpty however do not show this incompatibility warning when added / modified

What's your environment? (If it applies)

System:
    OS: Linux 6.12 Manjaro Linux
    Shell: 5.2.37 - /bin/bash
  Binaries:
    Node: 20.16.0 - /tmp/xfs-88cf9d03/node
    Yarn: 4.4.0 - /tmp/xfs-88cf9d03/yarn
  Databases:
    SQLite: 3.46.1 - /usr/bin/sqlite3
  npmPackages:
    @redwoodjs/auth-dbauth-setup: 8.4.1 => 8.4.1 
    @redwoodjs/cli-storybook-vite: 8.4.1 => 8.4.1 
    @redwoodjs/core: 8.4.1 => 8.4.1 
    @redwoodjs/project-config: 8.4.1 => 8.4.1

Are you interested in working on this?

  • I'm interested in working on this
@Philzen Philzen added the bug/needs-info More information is needed for reproduction label Dec 4, 2024
@Philzen Philzen changed the title [Bug?]: Storybook requires restart for every change to Cell hooks [Bug?]: Storybook requires restart for any change to afterQuery Cell hook Dec 4, 2024
@Philzen Philzen changed the title [Bug?]: Storybook requires restart for any change to afterQuery Cell hook [Bug?]: Storybook requires restart after adding afterQuery Cell hook Dec 4, 2024
@Philzen
Copy link
Contributor Author

Philzen commented Dec 6, 2024

Relates to #1673 (fixed via #1740)

@Philzen
Copy link
Contributor Author

Philzen commented Dec 27, 2024

Looks to be also related to #4834 and #4717. Maybe this could all be solved in one PR.

@Philzen Philzen changed the title [Bug?]: Storybook requires restart after adding afterQuery Cell hook [Bug]: Storybook requires restart after adding afterQuery Cell hook Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/needs-info More information is needed for reproduction
Projects
None yet
Development

No branches or pull requests

1 participant