'I have an action function that is populating the database with some info but isn't workig

I have an action function that is populating the database with some info,the action sometimes takes 40 seconds or so in finishing the request that is like

const creatingData = await createData();

Then I have a redirect that points to the created data but when i call api it take so many times.

return redirect(`/myInventory/${creatingData.id}`);

The point is that when the page is loaded, the main content is not there, but if I reload the page all the content appears correctly.

I have tested with this code.

(`/myawesomepage/${creatingData.id}`);

please suggests me any solution.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source