TLDR Web Dev · ARTICLES & TUTORIALS
NEXT.JS PROMISE RACING
Summary from the TLDR Web Dev newsletter
"Promise racing" is where the server waits for a promise to resolve unless it takes longer than a specified timeout (in this case, 1 second). If the promise resolves quickly, the data is sent directly to the client without any loading state, but if it takes too long, a loading spinner is shown while the promise continues resolving on the client side. This provides performance benefits by avoiding unnecessary loading states for fast requests while still gracefully handling slower ones.