Skip to content

Commit 4b90414

Browse files
author
SilviaAmAm
committed
👌 [#235] fix: Process PR feedback
1 parent 4f5c196 commit 4b90414

File tree

3 files changed

+10
-35
lines changed

3 files changed

+10
-35
lines changed

frontend/src/pages/informatieobjecttype/InformatieObjectType.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { useBreadcrumbItems, useCombinedSearchParams } from "~/hooks";
1717
import { useSubmitAction } from "~/hooks/useSubmitAction";
1818
import { convertFieldsetsToTabConfig } from "~/lib";
1919

20-
import { AttributeGridSection, TabConfig } from "../zaaktype";
20+
import { TabConfig } from "../zaaktype";
2121
import {
2222
BackendIOT,
2323
InformatieObjectTypeAction,
@@ -61,11 +61,10 @@ export function InformatieObjectTypePage() {
6161
}, [newIOTData]);
6262

6363
const onValidate = useCallback<FormValidator>((values: object) => {
64-
const errors = {};
6564
// This is a hack, we are using the validate method to update
6665
// the state of the informatieobjecttype used in the form
6766
setNewIOTData(values as PatchedBackendIOT);
68-
return errors;
67+
return {};
6968
}, []);
7069

7170
const getButtons = useCallback(
@@ -116,10 +115,12 @@ export function InformatieObjectTypePage() {
116115

117116
// We know that the IOT does not have expansions,
118117
// so we can narrow the type further
119-
const section = fieldSetConfigs[0]
120-
.sections[0] as AttributeGridSection<PatchedBackendIOT>;
118+
if (fieldSetConfigs[0].view !== "AttributeGrid") {
119+
// This should not happen.
120+
throw new Error("Something went wrong while rendering the data.");
121+
}
121122

122-
const fieldsetsWithFieldInfo = section.fieldsets.map(
123+
const fieldsetsWithFieldInfo = fieldSetConfigs[0].sections[0].fieldsets.map(
123124
(fieldset) =>
124125
[
125126
fieldset[0],

frontend/src/pages/informatieobjecttypen/InformatieObjectTypenPage.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
import { Button, Outline } from "@maykin-ui/admin-ui";
22
import { useCallback } from "react";
3-
import { NavLink, Outlet, useLoaderData, useLocation } from "react-router";
3+
import { NavLink, useLoaderData, useLocation } from "react-router";
44
import { getUUIDFromString } from "~/lib/format/string.ts";
55
import { components } from "~/types";
66
import { ListView } from "~/views";
77

88
import { InformatieObjectTypenLoaderData } from "./informatieobjecttype.loader";
99

10-
export function InformatieObjectTypeParentPage() {
11-
return <Outlet />;
12-
}
13-
1410
export function InformatieObjectTypenPage() {
1511
const loaderData = useLoaderData<InformatieObjectTypenLoaderData>();
1612
const { pathname } = useLocation();

frontend/src/routes.tsx

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ import {
1515
zaaktypenLoader,
1616
} from "~/pages";
1717
import { InformatieObjectTypeCreatePage } from "~/pages/informatieobjecttypecreate/InformatieObjectTypeCreatePage";
18-
import {
19-
InformatieObjectTypeParentPage,
20-
InformatieObjectTypenPage,
21-
} from "~/pages/informatieobjecttypen";
18+
import { InformatieObjectTypenPage } from "~/pages/informatieobjecttypen";
2219
import { informatieobjecttypenLoader } from "~/pages/informatieobjecttypen/informatieobjecttype.loader";
2320
import { zaaktypeAction } from "~/pages/zaaktype/zaaktype.action.ts";
2421

@@ -100,7 +97,7 @@ export const routes: RouteObject[] = [
10097
{
10198
id: "informatieobjecttypen",
10299
path: "informatieobjecttypen",
103-
element: <InformatieObjectTypeParentPage />,
100+
element: <Outlet />,
104101
children: [
105102
{
106103
index: true,
@@ -119,25 +116,6 @@ export const routes: RouteObject[] = [
119116
element: <InformatieObjectTypePage />,
120117
action: informatieobjecttypeAction,
121118
loader: informatieobjecttypeLoader,
122-
// shouldRevalidate: ({ currentUrl, nextUrl }) => {
123-
// const baseCurrent =
124-
// currentUrl.origin +
125-
// currentUrl.pathname +
126-
// currentUrl.search;
127-
// const baseNext =
128-
// nextUrl.origin + nextUrl.pathname + nextUrl.search;
129-
130-
// // If base is the same but hash differs, do NOT revalidate
131-
// if (
132-
// baseCurrent === baseNext &&
133-
// currentUrl.hash !== nextUrl.hash
134-
// ) {
135-
// return false;
136-
// }
137-
138-
// // Otherwise, revalidate
139-
// return true;
140-
// },
141119
},
142120
],
143121
},

0 commit comments

Comments
 (0)