From 4024e5db5a22491b82678402a9893ab222c35642 Mon Sep 17 00:00:00 2001 From: Nilotpal <50769314+Nilotpal35@users.noreply.github.com> Date: Tue, 11 Jul 2023 22:08:13 +0530 Subject: [PATCH] Update EventForm.js while using defer and Await from react-router-dom a instant redirect gives a error. Thats why i introduced this 1000 ms delay before redirecting. --- code/32-finished/frontend/src/components/EventForm.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/32-finished/frontend/src/components/EventForm.js b/code/32-finished/frontend/src/components/EventForm.js index 4798c3404b..f31ca7a3e1 100644 --- a/code/32-finished/frontend/src/components/EventForm.js +++ b/code/32-finished/frontend/src/components/EventForm.js @@ -116,7 +116,7 @@ export async function action({ request, params }) { if (!response.ok) { throw json({ message: 'Could not save event.' }, { status: 500 }); } - + await new Promise((res) => setTimeout(res, 1000)); return redirect('/events'); }