Skip to content

feat(query-devtools): add indicator for staleTime: 'static' in devtools #9215

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions packages/query-devtools/src/Devtools.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1263,6 +1263,17 @@
(e) => e.query.queryHash === props.query.queryHash,
)

const isStatic = createSubscribeToQueryCacheBatcher(

Check warning on line 1266 in packages/query-devtools/src/Devtools.tsx

View check run for this annotation

Codecov / codecov/patch

packages/query-devtools/src/Devtools.tsx#L1266

Added line #L1266 was not covered by tests
(queryCache) =>
queryCache()
.find({
queryKey: props.query.queryKey,
})
?.isStatic() ?? false,

Check warning on line 1272 in packages/query-devtools/src/Devtools.tsx

View check run for this annotation

Codecov / codecov/patch

packages/query-devtools/src/Devtools.tsx#L1272

Added line #L1272 was not covered by tests
true,
(e) => e.query.queryHash === props.query.queryHash,

Check warning on line 1274 in packages/query-devtools/src/Devtools.tsx

View check run for this annotation

Codecov / codecov/patch

packages/query-devtools/src/Devtools.tsx#L1274

Added line #L1274 was not covered by tests
)

const isStale = createSubscribeToQueryCacheBatcher(
(queryCache) =>
queryCache()
Expand Down Expand Up @@ -1337,6 +1348,9 @@
<Show when={isDisabled()}>
<div class="tsqd-query-disabled-indicator">disabled</div>
</Show>
<Show when={isStatic()}>

Check warning on line 1351 in packages/query-devtools/src/Devtools.tsx

View check run for this annotation

Codecov / codecov/patch

packages/query-devtools/src/Devtools.tsx#L1351

Added line #L1351 was not covered by tests
<div class="tsqd-query-static-indicator">static</div>
</Show>
</button>
</Show>
)
Expand Down Expand Up @@ -3180,6 +3194,17 @@
border-bottom: 1px solid ${t(colors.gray[300], colors.darkGray[400])};
font-size: ${font.size.xs};
}

& .tsqd-query-static-indicator {
align-self: stretch;
display: flex;
align-items: center;
padding: 0 ${tokens.size[2]};
color: ${t(colors.teal[800], colors.teal[300])};
background-color: ${t(colors.teal[100], colors.teal[900])};
border-bottom: 1px solid ${t(colors.teal[300], colors.teal[700])};
font-size: ${font.size.xs};
}
`,
selectedQueryRow: css`
background-color: ${t(colors.gray[200], colors.darkGray[500])};
Expand Down
Loading