Next.js Discord

Discord Forum

Show loading state during revalidation of cache tag

Unanswered
Wesley Janse posted this in #help-forum
Open in Discord
Hey, I’m searching for a way to track a transitions pending state to include the revalidation of a tag.

Currently the flow is as follows:
1. User updates the cart, for example quantity change. This is done via a server function and the state is tracked with a transition.
2. Within this server function we call revalidateTag to revalidate the users cart so all data is correctly updated.
3. During the transition we show a skeleton over the price row to indicate it’s recalculating the cart price and item prices.
4. The skeleton disappears before the cart is updated. This makes the UI less ideal.

Do you have any suggestions on how to tackle this without setting timeouts.

0 Replies