Skip to content

Commit

Permalink
select only what is used
Browse files Browse the repository at this point in the history
  • Loading branch information
kentcdodds committed Jul 11, 2022
1 parent 9709d0a commit 5dd109b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/models/note.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export function getNote({
userId: User["id"];
}) {
return prisma.note.findFirst({
select: { id: true, body: true, title: true },
where: { id, userId },
});
}
Expand Down
3 changes: 1 addition & 2 deletions app/routes/notes/$noteId.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ import { json, redirect } from "@remix-run/node";
import { Form, useCatch, useLoaderData } from "@remix-run/react";
import invariant from "tiny-invariant";

import type { Note } from "~/models/note.server";
import { deleteNote } from "~/models/note.server";
import { getNote } from "~/models/note.server";
import { requireUserId } from "~/session.server";

type LoaderData = {
note: Note;
note: NonNullable<Awaited<ReturnType<typeof getNote>>>;
};

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

0 comments on commit 5dd109b

Please sign in to comment.