Skip to content
This repository was archived by the owner on Jun 2, 2024. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: favorite revalidate
  • Loading branch information
hi-ogawa committed Apr 7, 2024
commit fa76b7e8336d7228f87d9ea811b133616798f997
6 changes: 4 additions & 2 deletions src/routes/_action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ export async function actionUpdateContact(
throw redirect(`/contacts/${contact.id}`);
}

export async function actoinFavorite(formData: FormData) {
export async function actoinFavorite(this: ActionContext, formData: FormData) {
this.revalidate = true;
const data = Object.fromEntries(formData) as any;
const contact = await fakeContacts.get(data.id);
tinyassert(contact);
Expand All @@ -45,6 +46,7 @@ export async function actionDeleteContact(
// TODO
// action response stream renders `src/routes/contacts/[contactId]/page.tsx`
// but contact doesn't exists anymore and server component throws,
// which makes this redirect error to not caught by client?
// which makes this redirect error to not caught by client
// when users don't have custom error page
throw redirect("/");
}