-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Expose a render API to stories #285
Conversation
A new UI element 'foldable' has been added. It allows code folding for the console. It mirrors the behavior found in most browser consoles, which is to start collapsed and expand upon selection.
So, we don't need to use classNames
* feat(highlight):added syntax highlighting in the action logger * fix lint error * fixed tests * added tests for highlight
* fix for re-render issue This worked for me. I'm no longer experiencing re-renders caused bu actions. * changed const to let * added comment and reference to issue * fixed typo * code style
My webpack configuration uses the `DefinePlugin` to make `process.env.NODE_ENV` available to my react components, which in turn optionally do different things depending on the NODE_ENV (related to debugging and such). Unfortunately, these development-only features don't show up when I use `build-storybook` because `build-storybook` overrides `process.env.NODE_ENV`. While I think it is quite reasonable for `build-storybook` to default to a "production ready" build, it should not unconditionally override the `NODE_ENV` environment variable to do so. This change makes `"production"` the default, but also allows people to set a different `NODE_ENV` value and have it get used.
fixed typo
remove semicolon
@@ -17,6 +17,7 @@ export function renderError(error) { | |||
} | |||
|
|||
export function renderMain(data, storyStore) { | |||
const rootElement = document.getElementById('root'); |
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.
I had to call this this inside the renderMain function as well as in the module, so that it could be properly stubbed. I think an improvement to this in future would be to pass the container element in as an argument to renderMain.
I think it's not a good idea to expose the renderMain as a public one. What we need is a reload API. |
Is the reload() API in place or in the pipeline? |
@mnmtanish This idea is great. But I need to expose it as a reload public API. Whic reloads the current story. Could you work on this based on these changes. (Hopefully) |
View your CI Pipeline Execution ↗ for commit 93895ac.
☁️ Nx Cloud last updated this comment at |
Following the suggestion by @arunoda in #197 - to expose a render API to allow stories to re-render themselves.
This is a rough first attempt. I've simply added a render function to the context object passed to the story.
I'd like to hear peoples thoughts, what is good, what is bad about this approach. I'm not all that familiar with this codebase but would find this addition helpful.
Thanks