For some reason now it works properly.

NOTE: this solution is unstable and can change in the future.
This commit is contained in:
2025-04-02 17:04:55 +02:00
parent 57c7440e65
commit f60847f9aa

View File

@@ -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