Clarify some comments
This commit is contained in:
@@ -146,6 +146,10 @@ export function useConfigQuery() {
|
|||||||
* @see https://tanstack.com/query/latest/docs/framework/react/guides/initial-query-data#initial-data-from-the-cache-with-initialdataupdatedat
|
* @see https://tanstack.com/query/latest/docs/framework/react/guides/initial-query-data#initial-data-from-the-cache-with-initialdataupdatedat
|
||||||
*/
|
*/
|
||||||
staleTime: IS_DEV ? 5e3 : 1000 * 60 * 60,
|
staleTime: IS_DEV ? 5e3 : 1000 * 60 * 60,
|
||||||
|
/**
|
||||||
|
* N.B. if prefetch failed above, we'll have no `initialData`, and this
|
||||||
|
* query will run on startup.
|
||||||
|
*/
|
||||||
initialData: getConfigFromCache(),
|
initialData: getConfigFromCache(),
|
||||||
initialDataUpdatedAt: () =>
|
initialDataUpdatedAt: () =>
|
||||||
qc.getQueryState(configQueryKey)?.dataUpdatedAt,
|
qc.getQueryState(configQueryKey)?.dataUpdatedAt,
|
||||||
|
|||||||
@@ -30,7 +30,13 @@ export function useAgeAssuranceState(): AgeAssuranceState {
|
|||||||
access: AgeAssuranceAccess.Safe,
|
access: AgeAssuranceAccess.Safe,
|
||||||
}
|
}
|
||||||
|
|
||||||
// should never happen, but need to guard
|
/**
|
||||||
|
* This can happen if the prefetch fails (such as due to network issues).
|
||||||
|
* The query handler will try it again, but if it continues to fail, of
|
||||||
|
* course we won't have config.
|
||||||
|
*
|
||||||
|
* In this case, fail open (unknown status/access) to avoid blocking users.
|
||||||
|
*/
|
||||||
if (!config) {
|
if (!config) {
|
||||||
logger.warn('useAgeAssuranceState: missing config')
|
logger.warn('useAgeAssuranceState: missing config')
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user