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

Web-components: Add full reload listening to server-side-events #14445

Merged
merged 4 commits into from
Apr 9, 2021

Conversation

brion-fuller
Copy link

@brion-fuller brion-fuller commented Apr 1, 2021

Issue: #12307

Web components cannot be hot reloaded as customElement.define can only be called once per page with an unique string. This has been on the users to add to their config file. Now this is available for free.

What I did

I hooked into server-sent events for webpack HMR and listen for the built event in which I trigger a page reload.

How to test

Is this testable with Jest or Chromatic screenshots? no
Does this need a new example in the kitchen sink apps? no
Does this need an update to the documentation? yes

@shilman shilman changed the title feat(12307): add full reload listening to server-side-events Web-components: Add full reload listening to server-side-events Apr 8, 2021
@@ -12,6 +13,6 @@ module.exports = {
'@storybook/addon-viewport',
],
core: {
builder: 'webpack4',
builder: 'webpack5',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK we can't use this in the monorepo

Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @brion-fuller!! @gaetanmaisse the CI results looks like an intermittent NPM failure so I'm merging anyway.

@shilman shilman merged commit 0aa48ce into storybookjs:next Apr 9, 2021
@steveblue
Copy link

Thank you @brion-fuller confirmed this works with vanilla custom elements.

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.

3 participants