Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions frontend/src/js/entity-history/saveAndLoad.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const useLoadHistory = ({

return useCallback(
({ label, data }: { label: string; data: string[][] }) => {
const loadedEntityIds: EntityId[] = [];
const distinctEntityIds: Set<EntityId> = new Set();
const loadedEntityStatus: EntityIdsStatus = {};
const loadedEntityStatusOptionsRaw: string[] = [];

Expand All @@ -67,7 +67,8 @@ export const useLoadHistory = ({

const [kind, id] = row;

loadedEntityIds.push({ kind, id });
// Deduplication is necessary for SecondaryId Queries
distinctEntityIds.add({ kind, id });

if (row.length > 2) {
loadedEntityStatus[id] = row
Expand All @@ -85,7 +86,7 @@ export const useLoadHistory = ({
...new Set(loadedEntityStatusOptionsRaw),
].map((item) => ({ label: item, value: item }));

if (loadedEntityIds.length === 0) {
if (distinctEntityIds.size === 0) {
dispatch(
setMessage({
message: t("history.load.error"),
Expand All @@ -95,6 +96,8 @@ export const useLoadHistory = ({
return;
}

const loadedEntityIds = [...distinctEntityIds];

onLoadFromFile({
label,
loadedEntityIds,
Expand Down
Loading