Next.js Discord

Discord Forum

Page not loading after redirect

Unanswered
American posted this in #help-forum
Open in Discord
AmericanOP
Hello!

I have a create page and an edit page. In my provider I have something like this:

const res = context.task
  ? await updateTask({
      taskId: context.task.id,
      data: object,
    })
  : await createTask(object);

if (res.data.type === "create") {
  router.push(`/edit/${res.data.taskId}`);
  router.refresh();
}
// more stuff


My problem is that after doing router.push my edit/[id]/page.tsx isn't "called". I added a console log to the edit page but it's never printed. How can I force it to happen?

I'm on 14.2.16

3 Replies

AmericanOP
Thanks for the reply James. Seems server redirect actually works fine, my e2e tests were just not handling the loading 🙄 the client side I couldn't get working, with or without refresh