Skip to content

Commit

Permalink
fix(manageView): stable initialValues for form
Browse files Browse the repository at this point in the history
  • Loading branch information
Birkbjo committed Oct 18, 2024
1 parent 2c7c9a9 commit 928f367
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/components/sectionList/listView/ManageListView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,20 @@ export const ManageListView = ({
const section = useModelSectionHandleOrThrow()
const { saveView } = useMutateModelListViews()

const columnsConfig = getColumnsForSection(section.name)
const filtersConfig = getFiltersForSection(section.name)
const { defaultColumns, defaultFilters, columnsConfig, filtersConfig } =
useMemo(() => {
const columnsConfig = getColumnsForSection(section.name)
const filtersConfig = getFiltersForSection(section.name)

const defaultColumns = columnsConfig.default.map(toPath)
const defaultFilters = filtersConfig.default.map(toFilterKey)
const defaultColumns = columnsConfig.default.map(toPath)
const defaultFilters = filtersConfig.default.map(toFilterKey)
return {
defaultColumns,
defaultFilters,
columnsConfig,
filtersConfig,
}
}, [section.name])

const handleSave = async (values: FormValues) => {
const isDefault = (arr: string[], def: string[]) =>
Expand Down

0 comments on commit 928f367

Please sign in to comment.