Skip to content

Commit

Permalink
UISACQCOMP-230 Fix version history label resolving
Browse files Browse the repository at this point in the history
  • Loading branch information
usavkov-epam committed Nov 25, 2024
1 parent a46de8d commit 214d861
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import escapeRegExp from 'lodash/escapeRegExp';
import PropTypes from 'prop-types';
import {
useContext,
Expand All @@ -21,7 +22,7 @@ export const VersionKeyValue = ({
const versionContext = useContext(VersionViewContext);
const isUpdated = useMemo(() => (
multiple
? versionContext?.paths?.find((field) => new RegExp(`^${name}\\[\\d\\]$`).test(field))
? versionContext?.paths?.find((field) => new RegExp(`^${escapeRegExp(name)}\\[\\d\\]$`).test(field))
: versionContext?.paths?.includes(name)
), [multiple, name, versionContext?.paths]);

Expand Down
13 changes: 7 additions & 6 deletions lib/hooks/useCategories/useCategories.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
} from '@folio/stripes/core';

import {
ALL_RECORDS_CQL,
CATEGORIES_API,
LIMIT_MAX,
} from '../../constants';
Expand All @@ -19,18 +20,18 @@ export const useCategories = (options = {}) => {

const searchParams = {
limit: LIMIT_MAX,
query: 'cql.allRecords=1',
query: ALL_RECORDS_CQL,
};

const {
data,
isFetching,
isLoading,
} = useQuery(
[namespace],
() => ky.get(CATEGORIES_API, { searchParams }).json(),
options,
);
} = useQuery({
queryKey: [namespace],
queryFn: ({ signal }) => ky.get(CATEGORIES_API, { searchParams, signal }).json(),
...options,
});

const [translatedCategories] = useTranslatedCategories(data?.categories);

Expand Down

0 comments on commit 214d861

Please sign in to comment.