-
-
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
Force re-render event #3515
Force re-render event #3515
Conversation
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 great, one minor tweak if you liek
lib/core/src/client/preview/start.js
Outdated
@@ -170,6 +171,10 @@ export default function start(render, { decorateStory } = {}) { | |||
|
|||
renderUI(); | |||
reduxStore.subscribe(renderUI); | |||
const forceReRender = () => renderUI(true); | |||
if (isBrowser) { | |||
channel.on(Events.FORCE_RE_RENDER, () => renderUI(true)); |
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.
Use the forceRerender
const here?
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.
Sure, forgot that
Issue: #1736 introduced an ability to force rerender story, but you have to depend on a particular framework to use it. I've introduced a
'forceReRender'
event that addons could use in a framework-agnostic way.This also introduces constants for core events as a separate package (to avoid circular dependency between
core
andui
)