From 5cff113e5bafca485813fbf4c0cbe9e004ef1de4 Mon Sep 17 00:00:00 2001
From: Duriel7 <78348490+Duriel7@users.noreply.github.com>
Date: Fri, 27 Dec 2024 17:30:19 +0100
Subject: [PATCH 1/4] Update create-your-first-crud.mdx
Changed the PageAdminProject.tsx file in src/features/projects where the update button is created, because id doesn't exist in UseTRPCQueryResult, => added "data" to project.id to be project.data.id
Then Typescript gives a security error saying data is possibly undefined, so I added a ?
Plus after that type string | undefined is not assignable to type string, so added ?? "Unknown" behind the line so Typescript knows it can be undefined.
---
pages/tutorials/create-your-first-crud.mdx | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/pages/tutorials/create-your-first-crud.mdx b/pages/tutorials/create-your-first-crud.mdx
index 067e81c..de480ae 100644
--- a/pages/tutorials/create-your-first-crud.mdx
+++ b/pages/tutorials/create-your-first-crud.mdx
@@ -2191,11 +2191,13 @@ export default function PageAdminProject() {
}
rightActions={
- }
- >
+ }
+ >
Edit
}
From 2276a890001c8a90136d5bea9632f1eb2576688b Mon Sep 17 00:00:00 2001
From: Duriel7 <78348490+Duriel7@users.noreply.github.com>
Date: Mon, 20 Jan 2025 10:06:17 +0100
Subject: [PATCH 2/4] Update create-your-first-crud.mdx
Updated fix:
To PageAdminProject.tsx page code to `params?.id?.toString() ?? 'unknown'` so it is the same syntax than other pages in the project.
To the lines that are shown as changed in the docs.
---
pages/tutorials/create-your-first-crud.mdx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pages/tutorials/create-your-first-crud.mdx b/pages/tutorials/create-your-first-crud.mdx
index de480ae..d581b6d 100644
--- a/pages/tutorials/create-your-first-crud.mdx
+++ b/pages/tutorials/create-your-first-crud.mdx
@@ -2176,7 +2176,7 @@ export default function Page() {
Now, in the `PageAdminProject.tsx` we can add an edit button which links to the update page.
-```tsx {1-4, 14-22} filename="src/features/projects/PageAdminProject.tsx" showLineNumbers
+```tsx {1-4, 14-24} filename="src/features/projects/PageAdminProject.tsx" showLineNumbers
import Link from "next/link";
import { LuPenLine } from "react-icons/lu";
import { ResponsiveIconButton } from "@/components/ResponsiveIconButton";
@@ -2194,7 +2194,7 @@ export default function PageAdminProject() {
}
>
From 3155fcdc1ae60cee87b93072abdc964bc3db1701 Mon Sep 17 00:00:00 2001
From: Duriel7 <78348490+Duriel7@users.noreply.github.com>
Date: Mon, 20 Jan 2025 13:11:57 +0100
Subject: [PATCH 3/4] Update create-your-first-crud.mdx
Updated fix with `isDisabled={!params?.id}` + added the line to showLineModified tsx setting.
---
pages/tutorials/create-your-first-crud.mdx | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/pages/tutorials/create-your-first-crud.mdx b/pages/tutorials/create-your-first-crud.mdx
index d581b6d..e074b84 100644
--- a/pages/tutorials/create-your-first-crud.mdx
+++ b/pages/tutorials/create-your-first-crud.mdx
@@ -2176,7 +2176,7 @@ export default function Page() {
Now, in the `PageAdminProject.tsx` we can add an edit button which links to the update page.
-```tsx {1-4, 14-24} filename="src/features/projects/PageAdminProject.tsx" showLineNumbers
+```tsx {1-4, 14-25} filename="src/features/projects/PageAdminProject.tsx" showLineNumbers
import Link from "next/link";
import { LuPenLine } from "react-icons/lu";
import { ResponsiveIconButton } from "@/components/ResponsiveIconButton";
@@ -2196,6 +2196,7 @@ export default function PageAdminProject() {
href={ROUTES_PROJECTS.admin.update({
params?.id?.toString() ?? 'unknown',
})}
+ isDisabled={!params?.id}
icon={}
>
Edit
From 0241c3a39ccf5914f11fb0f4a4cf2673c686c31a Mon Sep 17 00:00:00 2001
From: Duriel7 <78348490+Duriel7@users.noreply.github.com>
Date: Mon, 20 Jan 2025 13:23:45 +0100
Subject: [PATCH 4/4] Update create-your-first-crud.mdx
---
pages/tutorials/create-your-first-crud.mdx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pages/tutorials/create-your-first-crud.mdx b/pages/tutorials/create-your-first-crud.mdx
index e074b84..5649e57 100644
--- a/pages/tutorials/create-your-first-crud.mdx
+++ b/pages/tutorials/create-your-first-crud.mdx
@@ -2196,7 +2196,7 @@ export default function PageAdminProject() {
href={ROUTES_PROJECTS.admin.update({
params?.id?.toString() ?? 'unknown',
})}
- isDisabled={!params?.id}
+ isDisabled={!params?.id}
icon={}
>
Edit