Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions packages/html/.storybook/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ const resetMaxGraphConfigs = (): void => {
resetVertexHandlerConfig();
};

// This function is a workaround to destroy mxGraph elements that are not released by the previous story.
// See https://github.com/maxGraph/maxGraph/issues/400
function destroyUnreleasedElements() {
document.querySelectorAll('.mxPopupMenu,.mxWindow').forEach((e) => e.remove());
}

const preview: Preview = {
parameters: {
actions: { argTypesRegex: '^on[A-Z].*' },
Expand All @@ -39,6 +45,7 @@ const preview: Preview = {
// inspired by https://github.com/storybookjs/storybook/issues/4997#issuecomment-447301514
(storyFn) => {
resetMaxGraphConfigs();
destroyUnreleasedElements();
return storyFn();
},
],
Expand Down