Skip to content

Commit 99ad537

Browse files
committed
fix(storybook): full page reload on update
HMR is currently broken with lit-element: https://www.npmjs.com/package/@storybook/web-components#setup-page-reload-via-hmr
1 parent adfc79c commit 99ad537

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

.storybook/config.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
import { configure } from '@storybook/polymer';
22

33
// automatically import all files ending in *.stories.ts
4-
configure(require.context('../src', true, /\.stories\.ts$/), module);
4+
const req = require.context('../src', true, /\.stories\.ts$/);
5+
configure(req, module);
6+
if (module.hot) {
7+
module.hot.accept(req.id, () => {
8+
const currentLocationHref = window.location.href;
9+
window.history.pushState(null, null, currentLocationHref);
10+
window.location.reload();
11+
});
12+
}

0 commit comments

Comments
 (0)