Server: Phase 2 (REVIEW not respected yet)
This commit is contained in:
1 parent
5d16ded553
commit
142b47674d
4271 files changed
+1203269
No files matched your search
+22
@@ -0,0 +1,22 @@
|
||||
"use client";
|
||||
import * as React from "react";
|
||||
import { shouldThrowError } from "@tanstack/query-core";
|
||||
//#region src/errorBoundaryUtils.ts
|
||||
const ensurePreventErrorBoundaryRetry = (options, errorResetBoundary, query) => {
|
||||
const throwOnError = (query === null || query === void 0 ? void 0 : query.state.error) && typeof options.throwOnError === "function" ? shouldThrowError(options.throwOnError, [query.state.error, query]) : options.throwOnError;
|
||||
if (options.suspense || throwOnError) {
|
||||
if (!errorResetBoundary.isReset()) options.retryOnMount = false;
|
||||
}
|
||||
};
|
||||
const useClearResetErrorBoundary = (errorResetBoundary) => {
|
||||
React.useEffect(() => {
|
||||
errorResetBoundary.clearReset();
|
||||
}, [errorResetBoundary]);
|
||||
};
|
||||
const getHasError = ({ result, errorResetBoundary, throwOnError, query, suspense }) => {
|
||||
return result.isError && !errorResetBoundary.isReset() && !result.isFetching && query && (suspense && result.data === void 0 || shouldThrowError(throwOnError, [result.error, query]));
|
||||
};
|
||||
//#endregion
|
||||
export { ensurePreventErrorBoundaryRetry, getHasError, useClearResetErrorBoundary };
|
||||
|
||||
//# sourceMappingURL=errorBoundaryUtils.js.map
|
||||
Reference in new issue
Block a user