For some reason now it works properly.
NOTE: this solution is unstable and can change in the future.
This commit is contained in:
@@ -9,9 +9,7 @@ async function editContact(contactId: string, formData: FormData) {
|
||||
"use server";
|
||||
const updates = Object.fromEntries(formData);
|
||||
await updateContact(contactId, updates);
|
||||
revalidatePath('/(sidebar)', 'layout');
|
||||
revalidatePath(`/contacts/${contactId}`, 'page');
|
||||
revalidatePath(`/contacts/${contactId}/edit`, 'page');
|
||||
revalidatePath('/(sidebar)', 'layout'); // THE NESTED BEHAVIOR IS UNSTABLE AND CAN CHANGE IN FUTURE.
|
||||
redirect(`/contacts/${contactId}`); // This makes the server component data be reloaded.
|
||||
/*
|
||||
* The server component architecture is a HTMX-like structure where the component rendered is STATE-LESS
|
||||
|
||||
Reference in New Issue
Block a user