Skip to content

Commit 214d861

Browse files
committed
UISACQCOMP-230 Fix version history label resolving
1 parent a46de8d commit 214d861

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

lib/VersionHistory/components/VersionKeyValue/VersionKeyValue.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import escapeRegExp from 'lodash/escapeRegExp';
12
import PropTypes from 'prop-types';
23
import {
34
useContext,
@@ -21,7 +22,7 @@ export const VersionKeyValue = ({
2122
const versionContext = useContext(VersionViewContext);
2223
const isUpdated = useMemo(() => (
2324
multiple
24-
? versionContext?.paths?.find((field) => new RegExp(`^${name}\\[\\d\\]$`).test(field))
25+
? versionContext?.paths?.find((field) => new RegExp(`^${escapeRegExp(name)}\\[\\d\\]$`).test(field))
2526
: versionContext?.paths?.includes(name)
2627
), [multiple, name, versionContext?.paths]);
2728

lib/hooks/useCategories/useCategories.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
} from '@folio/stripes/core';
77

88
import {
9+
ALL_RECORDS_CQL,
910
CATEGORIES_API,
1011
LIMIT_MAX,
1112
} from '../../constants';
@@ -19,18 +20,18 @@ export const useCategories = (options = {}) => {
1920

2021
const searchParams = {
2122
limit: LIMIT_MAX,
22-
query: 'cql.allRecords=1',
23+
query: ALL_RECORDS_CQL,
2324
};
2425

2526
const {
2627
data,
2728
isFetching,
2829
isLoading,
29-
} = useQuery(
30-
[namespace],
31-
() => ky.get(CATEGORIES_API, { searchParams }).json(),
32-
options,
33-
);
30+
} = useQuery({
31+
queryKey: [namespace],
32+
queryFn: ({ signal }) => ky.get(CATEGORIES_API, { searchParams, signal }).json(),
33+
...options,
34+
});
3435

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

0 commit comments

Comments
 (0)