-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
v5 applies decorators to all the kind, no matter where it's placed #5781
Comments
I'm fairly sure this was an intentional change (right @ndelangen). Is it possible to add per-story decorators? It doesn't actually look like it is, but it would be easy to add via changing this line: To getDecorators: () => [...allParam.decorators, ...localDecorators, ..._globalDecorators, withSubscriptionTracking], (Arguably we should make If everyone is OK with this, my Decorator changesPreviously, adding decorators to a component/kind was "stateful". If you added a decorator after a story, the decorator would only apply to future stories. For example: storiesOf('Stories', module)
.add('noncentered', () => 'Hello')
.addDecorator(centered)
.add('centered', () => 'Hello'); Moving forward, we have a new API planned that will not support this. As it is clearer, if you want to apply a decorator to subset of a kind's stories, you can use the decorator parameter; storiesOf('Stories', module)
.add('noncentered', () => 'Hello')
.add('centered', () => 'Hello', { decorators: [centered] }); What does everyone think? We could also work to make the existing behaviour deprecated, but still work. I'm not sure how easy that is to do @ndelangen |
I added local decorators in #5806 |
@tmeasday I think we should deprecate the old behavior as part of the 5.0 release. Feels "tricky" to me... |
Deprecate or remove entirely?
…On 1 Mar 2019, 4:57 PM +1100, Michael Shilman ***@***.***>, wrote:
@tmeasday I think we should deprecate the old behavior as part of the 5.0 release. Feels "tricky" to me...
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Sorry, remove entirely and document rationale in |
storiesOf('Stories', module)
.add('noncentered', () => 'Hello')
.addDecorator(centered)
.add('centered', () => 'Hello');
I tend to agree. |
Yo-ho-ho!! I just released https://github.com/storybooks/storybook/releases/tag/v5.0.0-rc.8 containing PR #5806 that references this issue. Upgrade today to try it out! Because it's a pre-release you can find it on the Closing this issue. Please re-open if you think there's still more to do. |
I had an idea -- we could make I'll do the above and add the migration notes above if everyone is cool with it? |
Yes perfect! |
=> #5819 |
w00t!! I just released https://github.com/storybooks/storybook/releases/tag/v5.0.0-rc.9 containing PR #5819 that references this issue. Upgrade today to try it out! Because it's a pre-release you can find it on the Closing this issue. Please re-open if you think there's still more to do. |
V4: only second story is centered
V5: both stories are centered
This should be either fixed or documented in
MIGRATION.md
The text was updated successfully, but these errors were encountered: