mirror of
https://github.com/PeWu/topola-viewer.git
synced 2026-07-31 16:11:48 +00:00
Display images in details panel fromm gedzip files
This commit is contained in:
10
src/app.tsx
10
src/app.tsx
@@ -24,6 +24,7 @@ import {EmbeddedDataSource, EmbeddedSourceSpec} from './datasource/embedded';
|
||||
import {
|
||||
GedcomUrlDataSource,
|
||||
getSelection,
|
||||
revokeObjectUrls,
|
||||
UploadedDataSource,
|
||||
UploadLocationState,
|
||||
UploadSourceSpec,
|
||||
@@ -379,6 +380,7 @@ export function App() {
|
||||
if (state !== AppState.INITIAL) {
|
||||
setState(AppState.INITIAL);
|
||||
}
|
||||
setData(undefined);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -462,6 +464,14 @@ export function App() {
|
||||
};
|
||||
}, [mcpBridge]);
|
||||
|
||||
// Clean up object URLs created for uploaded images/files when the dataset
|
||||
// changes or the app unmounts to prevent memory leaks.
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
revokeObjectUrls(data?.images);
|
||||
};
|
||||
}, [data]);
|
||||
|
||||
useEffect(() => {
|
||||
mcpBridge.setData(data || null);
|
||||
}, [data, mcpBridge]);
|
||||
|
||||
Reference in New Issue
Block a user