diff --git a/src/components/RJST/Lenses/types/table.tsx b/src/components/RJST/Lenses/types/table.tsx index bf06639f..9480654a 100644 --- a/src/components/RJST/Lenses/types/table.tsx +++ b/src/components/RJST/Lenses/types/table.tsx @@ -1,4 +1,4 @@ -import React, { useEffect } from 'react'; +import React, { useEffect, useMemo } from 'react'; import { faTable } from '@fortawesome/free-solid-svg-icons/faTable'; import type { LensTemplate } from '..'; import type { CollectionLensRendererProps } from '.'; @@ -158,7 +158,7 @@ const TableRenderer = ({ rowKey = 'id', }: CollectionLensRendererProps) => { const { state: analytics } = useAnalyticsContext(); - const [columns, setColumns] = useColumns( + const [cols, setColumns] = useColumns( rjstContext.resource, properties, tagKeyRender, @@ -167,6 +167,14 @@ const TableRenderer = ({ const { actions, showAddTagDialog, setShowAddTagDialog, tagKeys } = useTagActions(rjstContext, data); + const columns = useMemo(() => { + return cols.filter( + (item) => + !item.key.startsWith('tag_column_') || + (tagKeys ?? []).includes(item.title), + ); + }, [tagKeys, cols]); + const memoizedPagination = React.useMemo( () => ({ itemsPerPage: pagination?.itemsPerPage ?? DEFAULT_ITEMS_PER_PAGE,