-
Notifications
You must be signed in to change notification settings - Fork 8.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
[Canvas][PoC] Add Redux Inspector to Storybook; standardize names and convert a few stories #69357
[Canvas][PoC] Add Redux Inspector to Storybook; standardize names and convert a few stories #69357
Conversation
Pinging @elastic/kibana-canvas (Team:Canvas) |
This is pretty rad overall! Are there ways for us to manipulate the redux state from the test file? The ability to modify the state directly from the storybook page is pretty cool I think I'm a little hesitant to go this direction though if it means we have to continue to maintain two separate storybook test groups (ours and the kbn-storybook stuff). Are any other teams running into these types of redux issues with their storybook tests? Is this something we could get buy-in to pull into kbn-storybook? |
@elasticmachine merge upstream |
@streamich Could you please help me get these changes/abilities integrated into |
@elasticmachine merge upstream |
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.
Looks good. Left a few comments that might be for discussion outside this PR
}, | ||
}; | ||
|
||
const reducers = combineReducers({ |
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.
Does this store used by Storybook even need all of the reducers and middleware, etc? Or should it just be used to provide state to components that need it?
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import React, { FC } from 'react'; |
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 prefer FunctionComponent
vs FC
but I ain't going to fight about it or anything. But, we should reach an agreement on one and stick to that. Maybe add a lint rule to force us to one or the other.
@elasticmachine merge upstream |
@elasticmachine merge upstream |
merge conflict between base and head |
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.
Operations: tweak to precommit config LGTM
💔 Build Failed
Failed CI StepsBuild metricsasync chunks size
page load bundle size
History
To update your PR or re-run it, just comment with: |
I'm going to split this PR up into better chunks. There's too much churn and too much to review at once. I'll be referring to this PR and branch moving forward, though. |
Summary
This PR is a proof-of-concept that would allow components to be connected to a mock workpad store.
There are a lot of parts to this PR:
Moving Storybook from
.storybook
tostorybook
There are a lot of gotchas around typing and using
eslint
in a directory that begins in a.
. It's been a constant pain, so I renamed the directory.Custom Storybook Addon for Redux Actions
I wrote a custom addon for Storybook that not only provides a
store
to anyredux
component, but also patches thedispatch
function to output the result of the action.As a result, we can test our components as if they were in Canvas, and also see the results of any action.
Applying a new component file structure for Redux components
I'm proposing a new structure for our components that is demonstrated here with
asset
,asset_manager
andworkpad_config
:The exporting file would be:
Gotchas
kbn-storybook
provides, and would require us to stay with our config, rather than migrate.