mirror of
https://github.com/PeWu/topola-viewer.git
synced 2026-05-26 23:26:15 +00:00
Fix loading from WikiTree by numeric id
This commit is contained in:
11
src/app.tsx
11
src/app.tsx
@@ -317,7 +317,6 @@ export function App() {
|
|||||||
const data = await loadData(args.sourceSpec, args.selection);
|
const data = await loadData(args.sourceSpec, args.selection);
|
||||||
// Set state with data.
|
// Set state with data.
|
||||||
setData(data);
|
setData(data);
|
||||||
setSelection(getSelection(data.chartData, args.selection));
|
|
||||||
setShowSidePanel(args.showSidePanel);
|
setShowSidePanel(args.showSidePanel);
|
||||||
setState(AppState.SHOWING_CHART);
|
setState(AppState.SHOWING_CHART);
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
@@ -328,15 +327,14 @@ export function App() {
|
|||||||
state === AppState.LOADING_MORE
|
state === AppState.LOADING_MORE
|
||||||
) {
|
) {
|
||||||
// Update selection if it has changed in the URL.
|
// Update selection if it has changed in the URL.
|
||||||
const newSelection = getSelection(data!.chartData, args.selection);
|
|
||||||
const loadMoreFromWikitree =
|
const loadMoreFromWikitree =
|
||||||
args.sourceSpec.source === DataSourceEnum.WIKITREE &&
|
args.sourceSpec.source === DataSourceEnum.WIKITREE &&
|
||||||
(!selection || selection.id !== newSelection.id);
|
(!selection || selection.id !== args.selection?.id);
|
||||||
setChartType(args.chartType);
|
setChartType(args.chartType);
|
||||||
setState(
|
setState(
|
||||||
loadMoreFromWikitree ? AppState.LOADING_MORE : AppState.SHOWING_CHART,
|
loadMoreFromWikitree ? AppState.LOADING_MORE : AppState.SHOWING_CHART,
|
||||||
);
|
);
|
||||||
updateDisplay(newSelection);
|
updateDisplay(args.selection!);
|
||||||
if (loadMoreFromWikitree) {
|
if (loadMoreFromWikitree) {
|
||||||
try {
|
try {
|
||||||
const data = await loadWikiTree(args.selection!.id, intl);
|
const data = await loadWikiTree(args.selection!.id, intl);
|
||||||
@@ -441,6 +439,7 @@ export function App() {
|
|||||||
switch (state) {
|
switch (state) {
|
||||||
case AppState.SHOWING_CHART:
|
case AppState.SHOWING_CHART:
|
||||||
case AppState.LOADING_MORE:
|
case AppState.LOADING_MORE:
|
||||||
|
const updatedSelection = getSelection(data!.chartData, selection);
|
||||||
const sidePanelTabs = [
|
const sidePanelTabs = [
|
||||||
{
|
{
|
||||||
menuItem: intl.formatMessage({
|
menuItem: intl.formatMessage({
|
||||||
@@ -448,7 +447,7 @@ export function App() {
|
|||||||
defaultMessage: 'Info',
|
defaultMessage: 'Info',
|
||||||
}),
|
}),
|
||||||
render: () => (
|
render: () => (
|
||||||
<Details gedcom={data!.gedcom} indi={selection!.id} />
|
<Details gedcom={data!.gedcom} indi={updatedSelection.id} />
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -479,7 +478,7 @@ export function App() {
|
|||||||
) : null}
|
) : null}
|
||||||
<Chart
|
<Chart
|
||||||
data={data!.chartData}
|
data={data!.chartData}
|
||||||
selection={selection!}
|
selection={updatedSelection}
|
||||||
chartType={chartType}
|
chartType={chartType}
|
||||||
onSelection={onSelection}
|
onSelection={onSelection}
|
||||||
freezeAnimation={freezeAnimation}
|
freezeAnimation={freezeAnimation}
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ async function getRelatives(
|
|||||||
{getChildren: true, getSpouses: true},
|
{getChildren: true, getSpouses: true},
|
||||||
getApiOptions(handleCors),
|
getApiOptions(handleCors),
|
||||||
);
|
);
|
||||||
if (response === []) {
|
if (!response) {
|
||||||
const id = keysToFetch[0];
|
const id = keysToFetch[0];
|
||||||
throw new TopolaError(
|
throw new TopolaError(
|
||||||
'WIKITREE_PROFILE_NOT_FOUND',
|
'WIKITREE_PROFILE_NOT_FOUND',
|
||||||
|
|||||||
Reference in New Issue
Block a user