Skip to content

Commit 3e7d715

Browse files
minseong0324TkDodo
andauthored
feat(query-devtools): add indicator for staleTime: "static" (#9215)
Co-authored-by: Dominik Dorfmeister <[email protected]>
1 parent 214fafd commit 3e7d715

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

packages/query-devtools/src/Devtools.tsx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,6 +1263,17 @@ const QueryRow: Component<{ query: Query }> = (props) => {
12631263
(e) => e.query.queryHash === props.query.queryHash,
12641264
)
12651265

1266+
const isStatic = createSubscribeToQueryCacheBatcher(
1267+
(queryCache) =>
1268+
queryCache()
1269+
.find({
1270+
queryKey: props.query.queryKey,
1271+
})
1272+
?.isStatic() ?? false,
1273+
true,
1274+
(e) => e.query.queryHash === props.query.queryHash,
1275+
)
1276+
12661277
const isStale = createSubscribeToQueryCacheBatcher(
12671278
(queryCache) =>
12681279
queryCache()
@@ -1337,6 +1348,9 @@ const QueryRow: Component<{ query: Query }> = (props) => {
13371348
<Show when={isDisabled()}>
13381349
<div class="tsqd-query-disabled-indicator">disabled</div>
13391350
</Show>
1351+
<Show when={isStatic()}>
1352+
<div class="tsqd-query-static-indicator">static</div>
1353+
</Show>
13401354
</button>
13411355
</Show>
13421356
)
@@ -3180,6 +3194,17 @@ const stylesFactory = (
31803194
border-bottom: 1px solid ${t(colors.gray[300], colors.darkGray[400])};
31813195
font-size: ${font.size.xs};
31823196
}
3197+
3198+
& .tsqd-query-static-indicator {
3199+
align-self: stretch;
3200+
display: flex;
3201+
align-items: center;
3202+
padding: 0 ${tokens.size[2]};
3203+
color: ${t(colors.teal[800], colors.teal[300])};
3204+
background-color: ${t(colors.teal[100], colors.teal[900])};
3205+
border-bottom: 1px solid ${t(colors.teal[300], colors.teal[700])};
3206+
font-size: ${font.size.xs};
3207+
}
31833208
`,
31843209
selectedQueryRow: css`
31853210
background-color: ${t(colors.gray[200], colors.darkGray[500])};

0 commit comments

Comments
 (0)