You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(react-query): allow retryOnMount when throwOnError is function (#9336) (#9338)
* test(react-query): add tests should retry on mount when throwOnError returns false
* fix(react-query): refine throwOnError retry logic for error boundary cases
When throwOnError is a function, allow retryOnMount to proceed even when error boundary hasn't reset,
while maintaining the prevention behavior for boolean throwOnError values.
* fix(react-query): enhance throwOnError logic in error boundaries
Refine behavior to handle function-type throwOnError, allowing retries when appropriate. Ensure boolean throwOnError values still prevent retries when the error boundary isn't reset.
* test: Add tests for `throwOnError` behavior in `useQuery`
This commit introduces tests to verify the behavior of the `throwOnError` callback in scenarios where `retryOnMount` is enabled. It ensures proper handling of retries based on the error state and the `throwOnError` function's return value. These tests improve the reliability and coverage of error handling logic in `useQuery`.
* fix(react-query): improve throwOnError logic with query state validation
- Pass query object to ensurePreventErrorBoundaryRetry for accurate state checking
- Preserve query deduplication behavior while fixing throwOnError function handling
- Fixes issue where throwOnError function couldn't access query error state
* fix(react-query): fix test flakiness and query cache timing (#9338)
- Replace vi.waitFor with vi.advanceTimersByTimeAsync in tests
- Use separate render results to avoid stale DOM references
- Inline fresh query lookup in ensurePreventErrorBoundaryRetry after _experimental_beforeQuery
* ci: apply automated fixes
* fix(react-query): refine retryOnMount logic and error boundary handling
- move query retrieval after `_experimental_beforeQuery` in `useBaseQuery`
- refactor `ensurePreventErrorBoundaryRetry` for better clarity
- make `query` parameter required in `ensurePreventErrorBoundaryRetry`
* ci: apply automated fixes
* feat(react-query): make query param required but nullable in ensurePreventErrorBoundaryRetry
* Apply suggestions from code review
* chore: size-limit
* chore: changeset
---------
Co-authored-by: Dominik Dorfmeister <[email protected]>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
0 commit comments