Skip to content

Commit

Permalink
fix formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
alisher-epam committed Nov 8, 2023
1 parent 3385e50 commit 1b88905
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/Donors/DonorsList.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { isEmpty } from 'lodash';
import PropTypes from 'prop-types';
import { useMemo } from 'react';

import { MultiColumnList } from '@folio/stripes/components';
import { useStripes } from '@folio/stripes/core';
Expand All @@ -9,27 +9,28 @@ import {
defaultColumnMapping,
defaultVisibleColumns,
} from './constants';

import { getDonorsListFormatter } from './utils';

export const DonorsList = ({
columnMapping,
columnWidths,
contentData,
formatter,
formatter: formatterProp,
id,
visibleColumns,
}) => {
const stripes = useStripes();
const canViewOrganizations = stripes.hasPerm('ui-organizations.view');
const defaultFormatter = isEmpty(formatter) || getDonorsListFormatter({ canViewOrganizations });
const formatter = useMemo(() => {
return formatterProp || getDonorsListFormatter({ canViewOrganizations });
}, [canViewOrganizations, formatterProp]);

return (
<MultiColumnList
id={id}
columnMapping={columnMapping}
contentData={contentData}
formatter={defaultFormatter}
formatter={formatter}
rowProps={alignRowProps}
visibleColumns={visibleColumns}
columnWidths={columnWidths}
Expand Down

0 comments on commit 1b88905

Please sign in to comment.