Skip to content

fix(query): drop the development warning about a cache key shard registered twice - #275

Merged
dangreen merged 1 commit into
mainfrom
fix/query-drop-shard-registered-twice-warning
Sep 30, 2026
Merged

dangreen merged 1 commit into
mainfrom
fix/query-drop-shard-registered-twice-warning

Conversation

@dangreen

Copy link
Copy Markdown
Member

Why

The development build of @nano_kit/query warned whenever queryKey() met a shard name it had registered before. A name comes again without any mistake: Vite runs a module again on a hot update and makes its keys anew, and a spec makes a key per test. The specs of query printed Cache key shard "test" is already registered: two builders with one name share one cache 36 times on every run. The check cannot tell such a key from a second builder that shares a cache by mistake.

What

  • The check in queryKey() is removed, with its spec in cache.spec.ts.
  • The warning about a key parameter that serializes to null stays.
  • Two builders with one name still share one cache.

Size

Nothing changes in production: the check was behind import.meta.env.DEV, dist/index.production.js of query builds byte for byte the same, and every size-limit entry of query measures it. The development build loses 208 B raw.

Notes

  • The warnings show with the default reporter only: Vitest switches to its minimal reporter, which hides the logs of passing tests, when an agent runs it. With --reporter=default the specs of query print 36 of them on main and none with this change.
  • oxlint, tsc and the unit tests of query pass, 165 of them, and so does the pre-push pnpm test.
  • docs: document the changes since 1.2.0 and add the DevTools page #271 described the warning in the docs of cache keys; the sentence is dropped there.

…stered twice

The development build warned whenever `queryKey()` met a shard name it had registered before. A name comes again without any mistake: Vite runs a module again on a hot update and makes its keys anew, and a spec makes a key per test, so the specs of query printed `Cache key shard "test" is already registered` 36 times on every run. The check cannot tell such a key from a second builder that shares a cache by mistake. Two builders with one name still share one cache.
dangreen added a commit that referenced this pull request Sep 30, 2026
…docs

#275 removes the warning from the development build of `@nano_kit/query`.
@codecov

codecov Bot commented Sep 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.77%. Comparing base (ed44f9a) to head (2730a49).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #275      +/-   ##
==========================================
- Coverage   85.79%   85.77%   -0.02%     
==========================================
  Files         166      166              
  Lines        3766     3761       -5     
  Branches      871      869       -2     
==========================================
- Hits         3231     3226       -5     
- Misses        358      359       +1     
+ Partials      177      176       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dangreen
dangreen merged commit 6a0749b into main Sep 30, 2026
10 of 11 checks passed
@dangreen
dangreen deleted the fix/query-drop-shard-registered-twice-warning branch September 30, 2026 18:45
@github-actions github-actions Bot mentioned this pull request Sep 30, 2026
dangreen added a commit that referenced this pull request Oct 4, 2026
…docs

#275 removes the warning from the development build of `@nano_kit/query`.
dangreen added a commit that referenced this pull request Oct 21, 2026
* docs: document the changes since 1.2.0 and add the DevTools page

The site, the package READMEs and the DOCS.md of the agent skills now describe the code on main instead of the 1.2.0 release:

- tasks attached to the signals they fill: `task($signal, ...)` and `waitTasks($signal)` replace the tasks pool, and `hydratable()` is the whole SSR setting of a query client
- `resolved` hands falsy values through and attaches its promise as a task
- the `SignalsMap` and `IndexedSignalsMap` classes replace the map functions
- the operators return plain values for static operands, `pick` and the `text` tag are new, `concat` is gone
- `latest`, `child`, `toHtmlAttribute`, and `escapeHtml` in the SSR adapter example
- a DevTools page in the Store section with the development builds and their warnings
- the pager labels follow the pages added between the sections, and stale samples in the agera, kida and store READMEs are fixed

The benchmark and bundle size numbers come from the comparison page branch, measured on 2026-09-27.

* docs: drop the warning about a shard registered twice from the query docs

#275 removes the warning from the development build of `@nano_kit/query`.

* docs: describe where a dependency lives in nested contexts and `provideAs`, and re-measure the bundles with DI

Core Concepts gets the Aliases and Nested Contexts sections: a dependency that is not provided lives in the deepest context that provides something it reads, otherwise in the top one, and every context below shares it. The React, Preact and Svelte integration pages say how their providers nest, and the kida README gets the same two sections. The weather example with DI and the rick-and-morty SSR examples are measured again with the new DI, the other rows stay as they are.

* docs: describe signal and `null` values of `format()` messages, `relativetime()` over a moment and the revalidation of a request in flight

The intl API page shows that the formatter of a `format()` message reads a signal or an accessor passed as the value and formats `null` as a missing value, and the `relativetime()` section is rewritten for a moment as the input: the unit picked by the distance between `largestUnit` and `smallestUnit`, the readings of zero, `relativeTo` and the 30-day month. Message Access in Core Concepts links the signal values, and Revalidating Cache in the query docs says that a revalidation restarts a request in flight. The skill docs are generated again.

* docs: re-measure the bundles with `@nano_kit/query` after the fix of a revalidation in flight

The fix adds 13 B to the query client. The weather rows with Nano Kit and the rick-and-morty rows with Nano Kit, client and SSR, are measured again with the same recipe: only the chunk with the query client differs from the last measurement, by those 13 B, and the other rows stay as they are.

* docs: re-measure the example bundles at the 2.0.0 release
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant