fix: allow access to the Update View button when a table column can be persisted (#1433)
Closes #1432
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import { useCallback } from 'react';
|
||||
|
||||
import type { ViewFieldMetadata } from '@/ui/editable-field/types/ViewField';
|
||||
import { sortAndFilterBarScopedState } from '@/ui/filter-n-sort/states/sortAndFilterBarScopedState';
|
||||
import { useRecoilScopedState } from '@/ui/utilities/recoil-scope/hooks/useRecoilScopedState';
|
||||
import { useRecoilScopedValue } from '@/ui/utilities/recoil-scope/hooks/useRecoilScopedValue';
|
||||
|
||||
@ -18,6 +19,10 @@ export const useTableColumns = () => {
|
||||
tableColumnsByKeyScopedSelector,
|
||||
TableRecoilScopeContext,
|
||||
);
|
||||
const [, setIsSortAndFilterBarOpen] = useRecoilScopedState(
|
||||
sortAndFilterBarScopedState,
|
||||
TableRecoilScopeContext,
|
||||
);
|
||||
|
||||
const handleColumnVisibilityChange = useCallback(
|
||||
(column: ColumnDefinition<ViewFieldMetadata>) => {
|
||||
@ -32,8 +37,14 @@ export const useTableColumns = () => {
|
||||
);
|
||||
|
||||
setTableColumns(nextColumns);
|
||||
setIsSortAndFilterBarOpen(true);
|
||||
},
|
||||
[setTableColumns, tableColumns, tableColumnsByKey],
|
||||
[
|
||||
setIsSortAndFilterBarOpen,
|
||||
setTableColumns,
|
||||
tableColumns,
|
||||
tableColumnsByKey,
|
||||
],
|
||||
);
|
||||
|
||||
return { handleColumnVisibilityChange };
|
||||
|
||||
Reference in New Issue
Block a user