Skip to content

Commit

Permalink
fix(search): bug with tags count on record update
Browse files Browse the repository at this point in the history
  • Loading branch information
roboto84 committed Nov 23, 2023
1 parent 0b66e5d commit 63f1465
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
4 changes: 1 addition & 3 deletions src/views/search/arcadia/components/ArcResult/ArcResult.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ export function ArcResult(props: ArcResultProps) {
{ deep: true },
);

if (state.tags.length !== camelCasedData.numberOfSubjects) {
dispatch({ type: SearchActionsEnum.LOAD_TAGS, value: camelCasedData.subjectsCounts });
}
dispatch({ type: SearchActionsEnum.LOAD_TAGS, value: camelCasedData.subjectsCounts });
});
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export function ArcResultEditConfirm(props: ArcResultEditConfirmProps) {
if (!isFetching) {
if (isError && error) {
editResult.editingMessage = `An error has occurred editing: ${itemEditPackage.data}`;
onEditConfirmed(editResult);
} else if (data) {
const arcDeleteResult: ArcEditItemResults = camelcaseKeys<ArcEditItemResults>(
data,
Expand All @@ -34,8 +33,9 @@ export function ArcResultEditConfirm(props: ArcResultEditConfirmProps) {
} else {
editResult.editingMessage = 'There was an issue with editing this record';
}
onEditConfirmed(editResult);
}
// TODO: Rid ourselves of the dependence on JS call stack manipulation here
setTimeout(() => onEditConfirmed(editResult), 0);
}

return (
Expand Down
4 changes: 1 addition & 3 deletions src/views/search/components/AddRecord/AddRecord.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ export function AddRecord(props: AddRecordProps) {
{ deep: true },
);

if (state.tags.length !== camelCasedData.numberOfSubjects) {
dispatch({ type: SearchActionsEnum.LOAD_TAGS, value: camelCasedData.subjectsCounts });
}
dispatch({ type: SearchActionsEnum.LOAD_TAGS, value: camelCasedData.subjectsCounts });
});
};

Expand Down

0 comments on commit 63f1465

Please sign in to comment.