-
SummaryNormally, I would expect my build to be deterministic, meaning if it succeeds the first time, it will always succeed especially across multiple deployments. Additional informationNo response ExampleNo response |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
The reason why certain operations, dynamic data access or Math.random, etc, suspend by default (require a fallback) is exactly what you describe. They are all truly asynchronous work, (in this context not limited to JS async mechanics necessarily), they take an indeterminate time to complete, under which we consider them pending, and might resolve or reject, and/or yield different results every time you call them. What The key thing here is, whether an operation at build time rejects or not, and if that changes the inherent deterministic nature of the your applications build step, is not given by
With If you build today with a cache life of If the process that generates this data fails, you can still assign a shorter cache life to that (but not too short). If your API service is down, then you might choose to act on that in the code, and render a different branch, under Then it really depends on the business case, if your service is truly down, then eventually all users, regardless of deployment instance, will start to see the error message, and depending on your revalidate/expire timings, the server will try to regenerate this UI, hopefully without overloading a fallen service. |
Beta Was this translation helpful? Give feedback.
The reason why certain operations, dynamic data access or Math.random, etc, suspend by default (require a fallback) is exactly what you describe. They are all truly asynchronous work, (in this context not limited to JS async mechanics necessarily), they take an indeterminate time to complete, under which we consider them pending, and might resolve or reject, and/or yield different results every time you call them.
What
use cacheallows you to do at build time, is to take a snapshot in time of these operations at-the-time-of-build, by actually running them, and paying upfront the time cost, and storing that result into the static shell (even Math.random). Further more you assign a cacheLif…