Next.js Discord

Discord Forum

Slow server actions blocking dynamic imports and other server actions.

Unanswered
Brown bear posted this in #help-forum
Open in Discord
Brown bearOP
Let's say you have some dynamic imports and other server actions running on the client side during on load.
Try this:

'use server'; // Server action

export default async function getSlow() {
  await new Promise((resolve) => setTimeout(resolve, 10000));
  return true;
}

// In some page..
useEffect(() => {
  (async () => {
    await getSlow();
  })();
}, []);


All other server actions and dynamic imports will be blocked until this slow server action is completed. Does anyone have this problem? Switching this function to client side will disable the blocking effect.

3 Replies