Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit 5dd109b

Browse files
committed
select only what is used
1 parent 9709d0a commit 5dd109b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

app/models/note.server.ts

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export function getNote({
1111
userId: User["id"];
1212
}) {
1313
return prisma.note.findFirst({
14+
select: { id: true, body: true, title: true },
1415
where: { id, userId },
1516
});
1617
}

app/routes/notes/$noteId.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@ import { json, redirect } from "@remix-run/node";
33
import { Form, useCatch, useLoaderData } from "@remix-run/react";
44
import invariant from "tiny-invariant";
55

6-
import type { Note } from "~/models/note.server";
76
import { deleteNote } from "~/models/note.server";
87
import { getNote } from "~/models/note.server";
98
import { requireUserId } from "~/session.server";
109

1110
type LoaderData = {
12-
note: Note;
11+
note: NonNullable<Awaited<ReturnType<typeof getNote>>>;
1312
};
1413

1514
export const loader: LoaderFunction = async ({ request, params }) => {

0 commit comments

Comments
 (0)