Skip to content

Commit

Permalink
fix: remove show all button and small changes to invalidate
Browse files Browse the repository at this point in the history
  • Loading branch information
flaminic committed Dec 18, 2024
1 parent 3d68912 commit e3e0e51
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 39 deletions.
4 changes: 2 additions & 2 deletions src/lib/form/useOnSubmit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const useOnSubmitEdit = <TFormValues extends IdentifiableObject>({
success: true,
})
queryClient.invalidateQueries({
queryKey: [{ resource: getSectionPath(section) }],
queryKey: [{ resource: section.namePlural }],
})
navigate(`/${getSectionPath(section)}`)
},
Expand Down Expand Up @@ -114,7 +114,7 @@ export const useOnSubmitNew = <TFormValues extends ModelWithAttributeValues>({
success: true,
})
queryClient.invalidateQueries({
queryKey: [{ resource: getSectionPath(section) }],
queryKey: [{ resource: section.namePlural }],
})
navigate(`/${getSectionPath(section)}`)
},
Expand Down
13 changes: 0 additions & 13 deletions src/pages/organisationUnits/list/OrganisationUnitList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -250,19 +250,6 @@ export const OrganisationUnitList = () => {
<OrganisationUnitRow
key={row.id}
row={row}
toggleShowAll={(id) =>
setParentIdsToLoad((prev) => {
const { [id]: wasShown, ...withoutId } =
prev
if (wasShown) {
return withoutId
}
return { ...prev, [id]: true }
})
}
showAllActive={
parentIdsToLoad[row.original.id] === true
}
onShowDetailsClick={handleDetailsClick}
isFiltering={isFiltering}
hasErrored={hasErrored}
Expand Down
24 changes: 0 additions & 24 deletions src/pages/organisationUnits/list/OrganisationUnitRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,12 @@ import { OrganisationUnitListActions } from './OrganisationUnitListActions'

export const OrganisationUnitRow = ({
row,
toggleShowAll,
showAllActive,
isFiltering,
fetchNextPage,
onShowDetailsClick,
hasErrored,
}: {
row: Row<OrganisationUnitListItem>
toggleShowAll: (id: string) => void
showAllActive: boolean
isFiltering: boolean
fetchNextPage: (id: string) => void
onShowDetailsClick: (model: BaseListModel) => void
Expand All @@ -47,26 +43,6 @@ export const OrganisationUnitRow = ({
>
{row.getCanExpand() ? (
<>
{isFiltering &&
(showAllActive ||
row.original.childCount !==
row.subRows.length) && (
<Button
secondary
onClick={() => {
toggleShowAll(row.original.id)
}}
icon={
showAllActive ? (
<IconArrowUp16 />
) : (
<IconArrowDown16 />
)
}
>
Show all
</Button>
)}
<Button
className={css.expandButton}
secondary
Expand Down

0 comments on commit e3e0e51

Please sign in to comment.