Skip to content

Commit

Permalink
improve: image dialog load speed
Browse files Browse the repository at this point in the history
  • Loading branch information
kuusei committed Jul 18, 2024
1 parent 3f4d9f3 commit f4a46b9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
11 changes: 9 additions & 2 deletions web/src/components/Dialog/BaseDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export function generateDialog<T extends DialogProps>(
config: DialogConfig,
DialogComponent: React.FC<T>,
props?: Omit<T, "destroy">,
withoutCommonContext = true,
): DialogCallback {
const tempDiv = document.createElement("div");
const dialog = createRoot(tempDiv);
Expand All @@ -90,11 +91,17 @@ export function generateDialog<T extends DialogProps>(
const Fragment = (
<Provider store={store}>
<CssVarsProvider theme={theme}>
<CommonContextProvider>
{withoutCommonContext ? (
<BaseDialog destroy={cbs.destroy} clickSpaceDestroy={true} {...config}>
<DialogComponent {...dialogProps} />
</BaseDialog>
</CommonContextProvider>
) : (
<CommonContextProvider>
<BaseDialog destroy={cbs.destroy} clickSpaceDestroy={true} {...config}>
<DialogComponent {...dialogProps} />
</BaseDialog>
</CommonContextProvider>
)}
</CssVarsProvider>
</Provider>
);
Expand Down
1 change: 1 addition & 0 deletions web/src/components/PreviewImageDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,5 +147,6 @@ export default function showPreviewImageDialog(imgUrls: string[] | string, initi
imgUrls: Array.isArray(imgUrls) ? imgUrls : [imgUrls],
initialIndex: initialIndex || 0,
},
true

Check failure on line 150 in web/src/components/PreviewImageDialog.tsx

View workflow job for this annotation

GitHub Actions / static-checks

Insert `,`
);
}

0 comments on commit f4a46b9

Please sign in to comment.