-
-
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
Fix react native server #7187
Fix react native server #7187
Conversation
This pull request is automatically deployed with Now. Latest deployment for this branch: https://monorepo-git-fix-react-native-server.storybook.now.sh |
@@ -89,7 +89,12 @@ export default class StoryStore extends EventEmitter { | |||
this._selection = data === undefined ? this._selection : { storyId, viewMode }; | |||
this._error = error === undefined ? this._error : error; | |||
|
|||
setTimeout(() => this.emit(Events.STORY_RENDER), 1); | |||
setTimeout(() => { | |||
if (this._channel) { |
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.
@ndelangen, I am not sure what kind of implications this could have.
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.
Should be fine, we want to migrate to using the channel for this anyway, might be good to add a code-comment there to know which is the preferred way.
@@ -89,7 +89,12 @@ export default class StoryStore extends EventEmitter { | |||
this._selection = data === undefined ? this._selection : { storyId, viewMode }; | |||
this._error = error === undefined ? this._error : error; | |||
|
|||
setTimeout(() => this.emit(Events.STORY_RENDER), 1); | |||
setTimeout(() => { | |||
if (this._channel) { |
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.
Should be fine, we want to migrate to using the channel for this anyway, might be good to add a code-comment there to know which is the preferred way.
app/react-native/src/preview/components/StoryListView/index.tsx
Outdated
Show resolved
Hide resolved
Awesome cleanup @Gongreg! Added a few comments for things to double check on but LGTM overall. |
I'll clean up the formatting |
@Gongreg the linting on most react-native code was actively disabled. I enabled it and fixed a ton of linting issues that came up. If you feel this should be in a separate PR, we could do that. |
It works for me here also. I think that it, this PR is finished :) |
Issue: #4716
What I did
Updated events to use storyId.
Removed some of the local state, now we depend on selection inside storyStore.
Stopped using legacy StoryStore api.
Now we are listening for STORY_RENDER event, which allows us to more easily sync between web and mobile.
How to test
Manual testing :(
I am having issues setting up dev env for storybook, so I couldn't run git hooks, sorry.