Skip to content

Commit 94812f1

Browse files
committed
chore: prevent stale preview popup
1 parent e3b6b76 commit 94812f1

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

packages/webui/src/client/ui/Shelf/DashboardPieceButton/usePreviewPopUpSession.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,13 @@ export function usePreviewPopUpSession(args: {
4444
}, [args.layerType, args.piece, args.contentStatus])
4545

4646
useEffect(() => {
47-
if (previewSessionRef.current && previewRequest.contents.length > 0) {
48-
previewSessionRef.current.update(previewRequest.contents)
47+
if (previewSessionRef.current) {
48+
if (previewRequest.contents.length === 0) {
49+
previewSessionRef.current.close()
50+
previewSessionRef.current = null
51+
} else {
52+
previewSessionRef.current.update(previewRequest.contents)
53+
}
4954
}
5055
}, [previewRequest])
5156

0 commit comments

Comments
 (0)