mirror of
https://github.com/PeWu/topola-viewer.git
synced 2026-08-03 09:31:52 +00:00
Fixed error message not being displayed on load failure.
This commit is contained in:
@@ -130,9 +130,9 @@ export class ChartView extends React.Component<RouteComponentProps, State> {
|
|||||||
indi?: string;
|
indi?: string;
|
||||||
generation?: number;
|
generation?: number;
|
||||||
}) {
|
}) {
|
||||||
|
const hash = md5(input.gedcom);
|
||||||
try {
|
try {
|
||||||
const data = convertGedcom(input.gedcom);
|
const data = convertGedcom(input.gedcom);
|
||||||
const hash = md5(input.gedcom);
|
|
||||||
const serializedData = JSON.stringify(data);
|
const serializedData = JSON.stringify(data);
|
||||||
sessionStorage.setItem(input.url || hash, serializedData);
|
sessionStorage.setItem(input.url || hash, serializedData);
|
||||||
this.setState(
|
this.setState(
|
||||||
@@ -142,10 +142,20 @@ export class ChartView extends React.Component<RouteComponentProps, State> {
|
|||||||
hash,
|
hash,
|
||||||
loading: false,
|
loading: false,
|
||||||
loadedUrl: input.url,
|
loadedUrl: input.url,
|
||||||
|
error: undefined,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.setState(Object.assign({}, this.state, {error: e.message}));
|
this.setState(
|
||||||
|
Object.assign({}, this.state, {
|
||||||
|
data: undefined,
|
||||||
|
selection: undefined,
|
||||||
|
hash,
|
||||||
|
loading: false,
|
||||||
|
error: 'Failed to read GEDCOM file',
|
||||||
|
loadedUrl: input.url,
|
||||||
|
}),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user