Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress ReactQueryDevtools hydration warnings #1613

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 20 additions & 5 deletions src/devtools/devtools.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,12 @@ export const ReactQueryDevtoolsPanel = React.forwardRef(

return (
<ThemeProvider theme={theme}>
<Panel ref={ref} className="ReactQueryDevtoolsPanel" {...panelProps}>
<Panel
ref={ref}
className="ReactQueryDevtoolsPanel"
{...panelProps}
suppressHydrationWarning
>
<style
dangerouslySetInnerHTML={{
__html: `
Expand Down Expand Up @@ -469,38 +474,44 @@ export const ReactQueryDevtoolsPanel = React.forwardRef(
>
<QueryKeys style={{ marginBottom: '.5rem' }}>
<QueryKey
suppressHydrationWarning
style={{
background: theme.success,
opacity: hasFresh ? 1 : 0.3,
}}
>
fresh <Code>({hasFresh})</Code>
fresh <Code suppressHydrationWarning>({hasFresh})</Code>
</QueryKey>{' '}
<QueryKey
suppressHydrationWarning
style={{
background: theme.active,
opacity: hasFetching ? 1 : 0.3,
}}
>
fetching <Code>({hasFetching})</Code>
fetching{' '}
<Code suppressHydrationWarning>({hasFetching})</Code>
</QueryKey>{' '}
<QueryKey
suppressHydrationWarning
style={{
background: theme.warning,
color: 'black',
textShadow: '0',
opacity: hasStale ? 1 : 0.3,
}}
>
stale <Code>({hasStale})</Code>
stale <Code suppressHydrationWarning>({hasStale})</Code>
</QueryKey>{' '}
<QueryKey
suppressHydrationWarning
style={{
background: theme.gray,
opacity: hasInactive ? 1 : 0.3,
}}
>
inactive <Code>({hasInactive})</Code>
inactive{' '}
<Code suppressHydrationWarning>({hasInactive})</Code>
</QueryKey>
</QueryKeys>
<div
Expand Down Expand Up @@ -553,13 +564,15 @@ export const ReactQueryDevtoolsPanel = React.forwardRef(
</div>
</div>
<div
suppressHydrationWarning
style={{
overflowY: 'auto',
flex: '1',
}}
>
{queries.map((query, i) => (
<div
suppressHydrationWarning
key={query.queryHash || i}
onClick={() =>
setActiveQueryHash(
Expand All @@ -577,6 +590,7 @@ export const ReactQueryDevtoolsPanel = React.forwardRef(
}}
>
<div
suppressHydrationWarning
style={{
flex: '0 0 auto',
width: '2rem',
Expand All @@ -599,6 +613,7 @@ export const ReactQueryDevtoolsPanel = React.forwardRef(
{query.observers.length}
</div>
<Code
suppressHydrationWarning
style={{
padding: '.5rem',
}}
Expand Down