Skip to content

Commit

Permalink
Merge branch 'master' into UISACQCOMP-231
Browse files Browse the repository at this point in the history
  • Loading branch information
alisher-epam authored Nov 29, 2024
2 parents 1f55a1a + ef26138 commit 62ad8ae
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 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
2 changes: 1 addition & 1 deletion lib/VersionHistory/getFieldLabels.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const getFieldLabels = (intl, paths, labelsMap = {}, hiddenFields = [], s

const { changedFields, systemChanges } = paths.reduce((acc, path) => {
const fieldLabel = labelsMapEntries.find(([fieldPath]) => {
const regex = new RegExp(`^${escapeRegExp(fieldPath).replace('\\\\d', '\\d')}$`);
const regex = new RegExp(`^${escapeRegExp(fieldPath).replaceAll('\\\\d', '\\d')}$`);

return regex.test(path);
})?.[1] || path;
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 62ad8ae

Please sign in to comment.