diff --git a/src/common/hooks/useProfileSchema.ts b/src/common/hooks/useProfileSchema.ts index f24514f5..83fc3c63 100644 --- a/src/common/hooks/useProfileSchema.ts +++ b/src/common/hooks/useProfileSchema.ts @@ -5,7 +5,7 @@ import { useInputsState, useProfileState, useStatusState, useUIState } from '@sr export const useProfileSchema = () => { const { selectedEntriesService, schemaWithDuplicatesService } = useServicesContext() as Required; const { setCollapsibleEntries } = useUIState(); - const { userValues, setUserValues, setSelectedEntries } = useInputsState(); + const { setUserValues, setSelectedEntries } = useInputsState(); const { setIsEditedRecord: setIsEdited } = useStatusState(); const { schema, setSchema } = useProfileState(); @@ -27,7 +27,7 @@ export const useProfileSchema = () => { setCollapsibleEntries(prev => deleteFromSetImmutable(prev, [entry.uuid])); setSchema(schemaWithDuplicatesService.get()); - setUserValues(Object.fromEntries(Object.entries(userValues).filter(([key]) => !deletedUuids?.includes(key)))); + setUserValues(prev => Object.fromEntries(Object.entries(prev).filter(([key]) => !deletedUuids?.includes(key)))); setIsEdited(true); }; diff --git a/src/components/CommonStatus/CommonStatus.tsx b/src/components/CommonStatus/CommonStatus.tsx index 7cdc11fe..d1078e91 100644 --- a/src/components/CommonStatus/CommonStatus.tsx +++ b/src/components/CommonStatus/CommonStatus.tsx @@ -16,7 +16,7 @@ export const CommonStatus: FC = () => { const { statusMessages, setStatusMessages } = useStatusState(); const deleteMessage = (messageId?: string) => { - setStatusMessages(statusMessages.filter(({ id }) => id !== messageId)); + setStatusMessages(prev => prev.filter(({ id }) => id !== messageId)); }; const deleteOldestMessage = () => deleteMessage(statusMessages[0].id); diff --git a/src/components/DuplicateGroupContainer/DuplicateGroupContainer.tsx b/src/components/DuplicateGroupContainer/DuplicateGroupContainer.tsx index 01d5432a..cc09eab0 100644 --- a/src/components/DuplicateGroupContainer/DuplicateGroupContainer.tsx +++ b/src/components/DuplicateGroupContainer/DuplicateGroupContainer.tsx @@ -30,6 +30,7 @@ export const DuplicateGroupContainer: FC = ({ setCollapsedEntries(prev => { const twinsAndPrevCombined = new Set([...(twins ?? []), ...prev]); + // Can use .difference method of Set() once it's been available for some time return twinsAndPrevCombined.size === prev.size ? deleteFromSetImmutable(prev, twins) : twinsAndPrevCombined; }); diff --git a/src/components/SearchControls/SearchControls.tsx b/src/components/SearchControls/SearchControls.tsx index cb01574f..273c1f2d 100644 --- a/src/components/SearchControls/SearchControls.tsx +++ b/src/components/SearchControls/SearchControls.tsx @@ -44,7 +44,7 @@ export const SearchControls: FC = ({ submitSearch, changeSegment, clearVa const setNavigationState = useSetRecoilState(state.search.navigationState); const resetControls = useResetRecoilState(state.search.limiters); const setFacetsBySegments = useSetRecoilState(state.search.facetsBySegments); - const { isAdvancedSearchOpen, setIsAdvancedSearchOpen } = useUIState(); + const { setIsAdvancedSearchOpen } = useUIState(); const [searchParams, setSearchParams] = useSearchParams(); const [announcementMessage, setAnnouncementMessage] = useState(''); const searchQueryParam = searchParams.get(SearchQueryParams.Query); @@ -150,7 +150,7 @@ export const SearchControls: FC = ({ submitSearch, changeSegment, clearVa