fix: codesanbox bug (#2842)

This commit is contained in:
jack zhang 2023-10-16 15:03:32 +08:00 committed by GitHub
parent dd892f5bae
commit dc97149164
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 18 deletions

View File

@ -202,15 +202,13 @@ const PreviewerActions: typeof DumiPreviewerActions = (props) => {
useEffect(() => {
if (div.current) {
const elements = div.current.querySelectorAll('.dumi-default-previewer-actions');
elements.forEach((element) => {
element.addEventListener('click', (e) => {
e.stopImmediatePropagation();
setLoading(true);
openCodeSandbox(props).finally(() => {
setLoading(false);
});
})
const element = div.current.querySelector('.dumi-default-previewer-action-btn');
element?.addEventListener('click', (e) => {
e.stopImmediatePropagation();
setLoading(true);
openCodeSandbox(props).finally(() => {
setLoading(false);
});
})
}
}, [div])

View File

@ -202,15 +202,13 @@ const PreviewerActions: typeof DumiPreviewerActions = (props) => {
useEffect(() => {
if (div.current) {
const elements = div.current.querySelectorAll('.dumi-default-previewer-actions');
elements.forEach((element) => {
element.addEventListener('click', (e) => {
e.stopImmediatePropagation();
setLoading(true);
openCodeSandbox(props).finally(() => {
setLoading(false);
});
})
const element = div.current.querySelector('.dumi-default-previewer-action-btn');
element?.addEventListener('click', (e) => {
e.stopImmediatePropagation();
setLoading(true);
openCodeSandbox(props).finally(() => {
setLoading(false);
});
})
}
}, [div])