Skip to content

Commit

Permalink
Fix decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
MatiasWorker committed Mar 17, 2024
1 parent 2d7ae8f commit e5b0f47
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@atomico/storybook",
"version": "2.6.2",
"version": "2.6.3",
"public": true,
"description": "Render Atomico's virtualDOM in Storybook",
"type": "module",
Expand Down
7 changes: 2 additions & 5 deletions packages/plugin/src/decorator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,7 @@ export const decorator =
(Story: () => any, context: StoryContext) => {
const cache = context.canvasElement as HTMLElement;

useStorybookEffect(() => {
const story = Story();
render(<host>{story}</host>, cache);
}, [context.id]);
useStorybookEffect(() => () => host.remove(), []);

if (!cache[context.id]) {
// Avoid double insertion by @storybook/web-components
Expand Down Expand Up @@ -116,5 +113,5 @@ export const decorator =
return "";
}

return new Comment("Atomico.decorator");
return host;
};

0 comments on commit e5b0f47

Please sign in to comment.