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

Expose a render API to stories #285

Closed
wants to merge 511 commits into from

Conversation

davidnormo
Copy link

@davidnormo davidnormo commented Jun 28, 2016

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

arunoda and others added 30 commits April 17, 2016 06:24
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
pcardune and others added 13 commits June 23, 2016 07:03
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
@@ -17,6 +17,7 @@ export function renderError(error) {
}

export function renderMain(data, storyStore) {
const rootElement = document.getElementById('root');
Copy link
Author

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.

@arunoda
Copy link
Member

arunoda commented Jun 29, 2016

I think it's not a good idea to expose the renderMain as a public one. What we need is a reload API.
Simply expose a reload() API, which simply re-render the current story.

@schrepfler
Copy link

Is the reload() API in place or in the pipeline?

@arunoda
Copy link
Member

arunoda commented Jul 14, 2016

@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)

Copy link

nx-cloud bot commented Jan 23, 2025

View your CI Pipeline Execution ↗ for commit 93895ac.

Command Status Duration Result
nx run-many -t build --parallel=3 ✅ Succeeded 7s View ↗

☁️ Nx Cloud last updated this comment at 2025-01-23 11:58:24 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.