Skip to content

Commit e07812b

Browse files
papercloverTkDodoautofix-ci[bot]
authored
fix(react-query): HydrationBoundary has strictly typed state (#9520)
* fix(react-query): HydrationBoundary has strictly typed `state` Only type definition changes, the `state` parameter is now required and must be `DehydratedState` (or nullish). Every case omitting this prop or passing a different shape is a bug now caught by `tsc`. Correct code has no action needed. Closes #9323 * ci: apply automated fixes --------- Co-authored-by: Dominik Dorfmeister <[email protected]> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent c8322d9 commit e07812b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/react-query/src/HydrationBoundary.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import type {
1111
} from '@tanstack/query-core'
1212

1313
export interface HydrationBoundaryProps {
14-
state?: unknown
14+
state: DehydratedState | null | undefined
1515
options?: OmitKeyof<HydrateOptions, 'defaultOptions'> & {
1616
defaultOptions?: OmitKeyof<
1717
Exclude<HydrateOptions['defaultOptions'], undefined>,
@@ -60,7 +60,7 @@ export const HydrationBoundary = ({
6060
// gracefully if it has the wrong shape, so while we type `queries`
6161
// as required, we still provide a fallback.
6262
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
63-
const queries = (state as DehydratedState).queries || []
63+
const queries = state.queries || []
6464

6565
const newQueries: DehydratedState['queries'] = []
6666
const existingQueries: DehydratedState['queries'] = []

0 commit comments

Comments
 (0)