Closed thekevinscott closed 4 years ago
cc @ndelangen
Happy to help you fix this bug if you want, schedule a meeting with me?
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!
Hey @thekevinscott, sorry you experienced issues with your setup. I checked your repo and in your Button stories you were using withQuery
as a default export but it's actually a named export! Once you fix that, the addon should work with no issues.
Another thing to note is that you should access the search params via document.location.search
or window.location.search
rather than document.search
. I did notice that in the README of addon-queryparams the example shows document.search
, so I will be fixing that. Thanks for opening this issue, it helps us improve things 😄
here's what you gotta do to fix your issue:
import React from 'react';
import { Button } from '@storybook/react/demo';
- import withQuery from '@storybook/addon-queryparams';
+ import { withQuery } from '@storybook/addon-queryparams';
export default {
title: 'Button',
component: Button,
decorators: [
withQuery,
],
parameters: {
query: {
mock: true,
},
},
};
- export const Text = () => <div>{document.search}</div>;
+ export const Text = () => <div>{document.location.search}</div>;
Let me know if that helps!
Describe the bug Attempting to include the decorator
storybook-addon-queryparams
fails to render.To Reproduce
yarn && yarn storybook
localhost:6006
Expected behavior I expect the decorator to work.
Code snippets https://github.com/thekevinscott/test-storybook-addon-queryparams
System:
Additional context It appears the docs are not set up to use "Component Story Format"; I tried to translate the installation procedures.