[2.0.0] Feature: an app-level default for a mutation that declares no `revalidate` (all | none), and a dev warning when the default fires
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 48/100
- Issue-Typ
- Feature
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- node.js, typescript
- Bereich
- backend-api-design
Rechercherichtung
Start with src/data/query.ts around the sweep logic and trace how responses reach it from setupFlightDataConsumer; then compare the formAction path in src/data/action.ts and router options in src/routing.ts. Decide how an app-level default and dev warning should work consistently across both paths. Done means undeclared revalidation follows the selected default and the diagnostic identifies the server function when the all-query default fires.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Describe the bug
Feature request, not a regression. In 2.0.0 a non-GET server-function call made inside a core action() (before its first await, or after a yield), or inside a router formAction, whose answer declares no revalidate, makes the router revalidate every query on screen. That rule is documented and was settled in #4883 / #4913. The only way to say "this changed nothing the page reads" is to write respond(value, { revalidate: [] }) (or "") in every such server function. A function that forgets it gets the sweep silently, and nothing tells the author which function did.
For an app whose server functions are mostly narrow (a cart line, a toggle, a sign-in step) the safe default is the opposite of the built-in one. Every missed declaration costs real work and visible effects:
- Reads in flight on the page are restarted by the sweep, including the ones a navigation was already waiting on.
- Reads that a CDN serves from a shared cache are refetched from the origin, because the sweep invalidates the client entry, not just the keys the call touched.
- An auth flow that ends a session re-reads every query under the session that just ended, so the refetches fail or return signed-out data before the redirect lands.
Where the rule is implemented:
@solidjs/web,packages/web/server-functions/src/client.tsL834-L835 (mutation = !isReadCall(options) && sources.length > 0,acted = mutation && actionDepth) and L929-L931: an acted call's response reaches the flight-data consumers even when it carries nothing;documentation/solid-2.0/10-server-functions.mdL133 (the 2026-11-16 ruling) describes it, andpackages/web/src/response.tsL156 documents the omittedrevalidateas "the host's default".@solidjs/router,src/data/query.tsL497 (const sweep = mutation || declared !== null) withkeysleftundefined(everything) when nothing was declared (L498), reached fromsetupFlightDataConsumer(L548-L552) for server-function calls and fromapplyResponseinsrc/data/action.ts(L640-L647) forformAction.- The only switch is
createRouter({ singleFlight: false })(src/routing.tsL1010, README options table), which turns the whole flight-data consumer off rather than changing the default. It also drops folded data and redirects.
There is no dev signal. A call that sweeps everything because nothing was declared looks the same in the console as one that meant it.
Your Example Website or App
No repro app: this is a request for a knob and a diagnostic. The existing behavior is the one in #4883 (the list refetches after a keyless call from an action), seen from the opposite side; for a runnable check of which slice of an action counts as "inside" see the companion issue about calls after the first await.
Steps to Reproduce the Bug or Issue
- A
query()read for a list and a"use server"functiontouch()that returns nothing. - Call
touch()from a coreaction()(or aformAction). - The Network panel shows
POST /_server/…touch, then aGETfor the list. The list read was not related totouch. - To avoid it,
touch()must returnrespond(null, { revalidate: [] }).
Expected behavior
Either (or both) of:
- A router option for the default, for example
createRouter({ revalidate: 'all' | 'none' })with'all'as today's default. With'none', an answer that declares nothing sweeps nothing and an author opts in per function withrevalidate: [...]or"*", which the protocol already has (REVALIDATE_ALL,query.tsL561-L566). It would apply on both paths above (flight-data consumer andformAction), so one setting covers a server function called from an action and from a form. - A dev-only diagnostic, once per function id, when the router applies the "everything" default to an answer that declared nothing, naming the server function (the transport knows the id at the call site) and the fix:
[REVALIDATE_UNDECLARED] server function "<id>" answered an action without declaring revalidate; every query on screen was refetched. Declare respond(v, { revalidate: [...] }), { revalidate: [] } for none, or "*" for all.An app that wants the sweep silences it by writing"*".
(2) alone is enough to make the default discoverable; (1) removes the need to touch every function.
Screenshots or Videos
No response
Platform
- OS: macOS
- Runtime: Node 26.13.1
- Version:
solid-js/@solidjs/web/@solidjs/router2.0.0,@solidjs/vite-plugin3.0.0
- Vorherrschende Sprache
- TypeScript
- Sterne
- 1.3k
- Forks
- 193
- Ø Merge
- 8 Std. 48 Min.
- Gemergte PRs (30 T.)
- 21
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus solidjs/solid-router
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 77/100
solidjs/solid-router#757 ·
Maintainer antworten meist innerhalb von 1 Tag
-
[2.0.1] Internal links do a full page load on a custom scheme (Electron app://)Evtl. vergeben @saudademjj hat das vor 1 Tag übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 20/100
solidjs/solid-router#755 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
[2.0.1] diagnostics: a request for // crashes the dev server (Invalid URL in describeInitial)Evtl. vergeben @bryanlundberg hat das vor 4 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 35/100
solidjs/solid-router#752 ·
Maintainer antworten meist innerhalb von 1 Tag
-
liveQuery SSR: the producer of a `live()` server function is never finalized after the response ends (the `return()` queues behind a read-ahead `next()`)Evtl. vergeben @clean99 hat das vor 2 Tagen übernommen. Offen
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
solidjs/solid-router#751 ·
Maintainer antworten meist innerhalb von 1 Tag
-
[2.0.1] hashHistory: link claims and useLinkState ignore the hash, so aria-current/data-active are wrong on every linkEvtl. vergeben @clean99 hat das vor 10 Tagen übernommen. Offen
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 72/100
solidjs/solid-router#746 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in solidjs/solid-router
Ähnliche Issues
-
blocklist addition
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 76/100
MetaMask/eth-phishing-detect#319194 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
continuedev/continue#13533 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 6 Tagen
-
bug codex:automation
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
genfeedai/genfeed.ai#12060 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bounty good first issue help wanted
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
fitzss/valun-open#15 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag