@rsc-kit/mcp 0.41.0 → 0.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/recipes.js +12 -2
- package/dist/recipes.js.map +1 -1
- package/guides/admin-plugins.md +206 -6
- package/guides/api-routes.md +159 -215
- package/guides/authorization.md +103 -114
- package/guides/backend-answered-pages.md +301 -252
- package/guides/bap-vs-inertia.md +67 -25
- package/guides/blueprints.md +300 -169
- package/guides/bun.md +42 -25
- package/guides/caching.md +46 -49
- package/guides/coming-from-inertia.md +2 -2
- package/guides/commands.md +251 -200
- package/guides/connection.md +50 -54
- package/guides/content-security-policy.md +133 -84
- package/guides/domains.md +190 -149
- package/guides/edge-caching.md +242 -268
- package/guides/emails.md +96 -45
- package/guides/errors.md +116 -137
- package/guides/feature-flags.md +100 -30
- package/guides/file-uploads.md +101 -26
- package/guides/fonts.md +139 -110
- package/guides/forms.md +520 -542
- package/guides/images.md +87 -28
- package/guides/index.json +13 -33
- package/guides/instrumentation.md +134 -95
- package/guides/isr.md +3 -3
- package/guides/live-data-in-production.md +695 -0
- package/guides/live-data.md +170 -839
- package/guides/mcp.md +83 -59
- package/guides/metadata.md +124 -179
- package/guides/navigation.md +118 -147
- package/guides/no-javascript.md +49 -57
- package/guides/offline.md +118 -153
- package/guides/openapi.md +100 -35
- package/guides/pages.md +160 -50
- package/guides/ppr.md +178 -256
- package/guides/pwa.md +251 -218
- package/guides/queries.md +171 -300
- package/guides/react-compiler.md +90 -50
- package/guides/redirects.md +141 -177
- package/guides/response-headers.md +76 -74
- package/guides/route-interception.md +112 -111
- package/guides/routing.md +216 -322
- package/guides/sections.md +63 -66
- package/guides/seo-files.md +127 -65
- package/guides/server-actions.md +285 -357
- package/guides/static-generation.md +131 -199
- package/guides/testing.md +269 -147
- package/guides/third-party-scripts.md +94 -47
- package/guides/typed-routes.md +115 -113
- package/guides/url-validation.md +113 -61
- package/guides/validation.md +53 -62
- package/guides/view-transitions.md +159 -132
- package/guides/where-it-runs.md +226 -162
- package/package.json +2 -2
- package/guides/admin.md +0 -520
- package/guides/deployment.md +0 -598
- package/guides/go.md +0 -539
- package/guides/laravel.md +0 -787
- package/guides/your-own-backend.md +0 -602
package/guides/navigation.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# Navigation
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> Moving between pages without a reload - visit, prefetch, progress, refresh, and measuring a click.
|
|
4
4
|
|
|
5
|
-
`Link`
|
|
6
|
-
|
|
5
|
+
`Link` moves to another page without reloading the document. Only the part
|
|
6
|
+
below the layouts both pages share is fetched and rendered:
|
|
7
7
|
|
|
8
8
|
```tsx
|
|
9
9
|
import Link from '@rsc-kit/core/Link'
|
|
@@ -11,142 +11,87 @@ import Link from '@rsc-kit/core/Link'
|
|
|
11
11
|
<Link href="/about">About</Link>
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
The `Link` props are listed in [Routing](/guides/routing#linking-between-pages).
|
|
15
|
+
This page covers navigating from code, prefetching, progress, refreshing, and
|
|
16
|
+
measuring a navigation.
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
are already mounted and identical. The client says which layouts it holds, the
|
|
18
|
-
server compares that with the new route's chain, and answers with the deepest
|
|
19
|
-
piece that differs — the page alone.
|
|
20
|
-
|
|
21
|
-
You get this for free. There is nothing to configure and no `loading` prop to
|
|
22
|
-
thread.
|
|
23
|
-
|
|
24
|
-
Two things follow from it, and they are the reason it works this way:
|
|
25
|
-
|
|
26
|
-
**State above the swap survives.** A sidebar's scroll position, an open menu, a
|
|
27
|
-
half-typed form in a layout — none of it is touched, because none of it was
|
|
28
|
-
re-rendered.
|
|
29
|
-
|
|
30
|
-
**A page you return to is still there.** Recently visited pages are kept mounted
|
|
31
|
-
and hidden rather than thrown away, so going back restores a half-filled form
|
|
32
|
-
exactly as you left it. Only a handful are kept, ordered by last visit.
|
|
33
|
-
|
|
34
|
-
## Programmatic navigation
|
|
18
|
+
## Navigating from code
|
|
35
19
|
|
|
36
20
|
```tsx
|
|
37
21
|
'use client'
|
|
38
|
-
|
|
39
|
-
import { visit, prefetch } from '@rsc-kit/core/router'
|
|
22
|
+
import { visit } from '@rsc-kit/core/router'
|
|
40
23
|
|
|
41
24
|
<button onClick={() => visit('/checkout')}>Checkout</button>
|
|
42
25
|
```
|
|
43
26
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
```tsx
|
|
48
|
-
useEffect(() => { prefetch('/step-2') }, [])
|
|
49
|
-
useEffect(() => { prefetch('/step-2', undefined, { intent: true }) }, []) // and decode it now
|
|
27
|
+
```ts
|
|
28
|
+
await visit('/dashboard', { replace: true }) // no new history entry
|
|
50
29
|
```
|
|
51
30
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
A navigation is as fast as what is in the browser when the click lands, and
|
|
55
|
-
a click that has to wait for the network is what a single-page app never
|
|
56
|
-
does. So a `<Link>` fetches its page before it is asked to, in two steps,
|
|
57
|
-
because the two cost differently:
|
|
58
|
-
|
|
59
|
-
- **The bytes, as the link comes into view.** The first dozen links on
|
|
60
|
-
screen per page, on every device, when the browser is idle, once per link,
|
|
61
|
-
at low priority so a real navigation overtakes the queue — the way Next
|
|
62
|
-
prefetches. A dozen, because a payload carries the whole page: a product
|
|
63
|
-
page with its related products is 30 KB, and a listing shows twenty-four of
|
|
64
|
-
them. A link past the budget is fetched on touch or on a settled hover, a
|
|
65
|
-
round trip before the click rather than before the scroll. The payload is
|
|
66
|
-
kept undecoded: thirty seconds for a page rendered per visitor, five
|
|
67
|
-
minutes for one the build made (the host marks it `public`, and only a
|
|
68
|
-
deploy changes it — which the [version handshake](/hosts/deployment#pages-across-a-deploy)
|
|
69
|
-
catches on the click). `cacheFor` on the link sets its own. A link asks
|
|
70
|
-
again when it comes back into view and when the tab is visible again, which
|
|
71
|
-
costs a request only for a payload that has expired: the nav a visitor
|
|
72
|
-
scrolls back to after a minute of reading is fresh when they tap it. Not on
|
|
73
|
-
a timer, so a page left open fetches nothing.
|
|
74
|
-
- **The pictures, as the bytes land.** Every `<img>` the page shows is a row
|
|
75
|
-
in its payload, so the ones it would load at once — not `loading="lazy"` —
|
|
76
|
-
are asked for at low priority the moment the payload arrives, the first six a
|
|
77
|
-
page — a product's own picture comes before its related ones. On a phone a product picture takes longer than the touch-to-click
|
|
78
|
-
a hidden render has, and the click should find it decoded. On intent the
|
|
79
|
-
same pictures are asked for again as urgent: a listing's tiles each
|
|
80
|
-
preload their product's picture, and the one tapped first was queued
|
|
81
|
-
behind the rest; asked for as high priority it moves to the front.
|
|
82
|
-
- **The code for its client components, as the bytes land.** A payload names
|
|
83
|
-
each client component it renders, and the first eight a page renders are
|
|
84
|
-
loaded at idle the moment the payload arrives — the code only, nothing
|
|
85
|
-
rendered. Loaded at the touch instead, the first page of a visit waited on
|
|
86
|
-
its form's chunk *after* it had arrived, and showed its skeleton for a
|
|
87
|
-
quarter of a second; every later page found the chunk cached. Measured on an
|
|
88
|
-
iPhone, tapping through a fresh session: the first product page went from
|
|
89
|
-
~325 ms with a skeleton to ~80 ms without one. Bounded per document, so a
|
|
90
|
-
landing page with a link to a heavy editor does not load the editor for
|
|
91
|
-
everyone.
|
|
92
|
-
- **The decode, on intent.** Decoding the payload itself waits for the signal
|
|
93
|
-
that says which link is meant: a pointer that has settled on the link for
|
|
94
|
-
100 ms, a press, a touch. Each of those leads its click by 60–300 ms — about
|
|
95
|
-
a round trip — which is when the page is rendered hidden, so the click
|
|
96
|
-
reveals it.
|
|
97
|
-
|
|
98
|
-
The click then reads a decoded tree, changes the url, and hands the page to
|
|
99
|
-
React. Nothing on the network is between the click and the page unless the
|
|
100
|
-
link was never on screen, or the visitor asked for less data (Save-Data
|
|
101
|
-
turns the viewport prefetch off; the hover and the touch still fetch).
|
|
102
|
-
|
|
103
|
-
A link to a guarded page — every "Sign in" on a landing page points at the
|
|
104
|
-
app, and a signed-out visitor is sent to `/login` — is prefetched the same
|
|
105
|
-
way: the guard's answer is kept, and the destination is prefetched too, so
|
|
106
|
-
the tap asks for nothing.
|
|
107
|
-
|
|
108
|
-
### Measuring one
|
|
109
|
-
|
|
110
|
-
"Slow on my phone" needs a number, and the number it needs is the click to
|
|
111
|
-
the page on screen — not a request in a network panel. Every navigation
|
|
112
|
-
leaves it on the browser's timeline, in the User Timing API the Performance
|
|
113
|
-
panel of any dev tools draws:
|
|
114
|
-
|
|
115
|
-
| mark | when |
|
|
116
|
-
| --- | --- |
|
|
117
|
-
| `rsc-kit:navigate:start` | the click |
|
|
118
|
-
| `rsc-kit:navigate:decoded` | the payload decoded and the chunks it names loaded |
|
|
119
|
-
| `rsc-kit:navigate:applied` | handed to React |
|
|
120
|
-
| `rsc-kit:navigate` (measure) | start to the commit that put the page on screen |
|
|
31
|
+
A default export is available too, if you prefer `router.visit('/about')`.
|
|
121
32
|
|
|
122
|
-
|
|
33
|
+
## What a navigation keeps
|
|
123
34
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
```
|
|
35
|
+
Going from `/posts/one` to `/posts/two`, the root layout and the posts layout
|
|
36
|
+
are already on screen, so only the page is replaced. That has two effects:
|
|
127
37
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
38
|
+
- **State in a layout survives.** A sidebar's scroll position, an open menu or
|
|
39
|
+
a half-typed search box in a layout is left alone, because the layout isn't
|
|
40
|
+
rendered again.
|
|
41
|
+
- **A page you go back to is still there.** The last few pages visited are
|
|
42
|
+
kept mounted and hidden, so Back restores a half-filled form as it was left.
|
|
133
43
|
|
|
134
|
-
|
|
135
|
-
|
|
44
|
+
## Prefetching
|
|
45
|
+
|
|
46
|
+
A `<Link>` loads its page before it is clicked, so the click usually finds the
|
|
47
|
+
page ready. To prefetch a page you know someone is going to next:
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
'use client'
|
|
51
|
+
import { prefetch } from '@rsc-kit/core/router'
|
|
52
|
+
|
|
53
|
+
useEffect(() => { prefetch('/step-2') }, [])
|
|
54
|
+
useEffect(() => { prefetch('/step-2', undefined, { intent: true }) }, []) // and decode it now
|
|
136
55
|
```
|
|
137
56
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
57
|
+
The second argument is how long the payload stays usable, in milliseconds.
|
|
58
|
+
`intent: true` also decodes it as it lands, which loads the page's client
|
|
59
|
+
code: use it for a page the visitor is about to open, not one they may never
|
|
60
|
+
open.
|
|
61
|
+
|
|
62
|
+
### What a click finds already there
|
|
63
|
+
|
|
64
|
+
A link prefetches in steps, because each costs differently:
|
|
65
|
+
|
|
66
|
+
- **The page's data, as the link comes into view.** The first dozen links on
|
|
67
|
+
screen, on every device, when the browser is idle, at low priority so a
|
|
68
|
+
real navigation goes first. A link past the dozen is fetched on touch or on
|
|
69
|
+
a hover. The data is kept for thirty seconds for a page rendered per
|
|
70
|
+
visitor, and five minutes for a page the build made; `cacheFor` on the link
|
|
71
|
+
sets its own. A link asks again when it comes back into view, or the tab
|
|
72
|
+
does, only if what it holds has expired. Nothing is fetched on a timer, so
|
|
73
|
+
a page left open fetches nothing.
|
|
74
|
+
- **The images, as the data arrives.** The first six images the page shows at
|
|
75
|
+
once (not `loading="lazy"`) are requested at low priority, and again at high
|
|
76
|
+
priority when the visitor shows intent.
|
|
77
|
+
- **The client code, as the data arrives.** The code for the first eight client
|
|
78
|
+
components the page renders is loaded while the browser is idle.
|
|
79
|
+
- **The decode, on intent.** The page is decoded and rendered hidden when a
|
|
80
|
+
pointer rests on the link for 100 ms, or on a press or a touch. Each of
|
|
81
|
+
those comes 60-300 ms before the click, so the click shows a page that is
|
|
82
|
+
already rendered.
|
|
83
|
+
|
|
84
|
+
With Save-Data on, links don't prefetch as they come into view; hover and
|
|
85
|
+
touch still do. A link to a guarded page - "Sign in" to an app that sends a
|
|
86
|
+
signed-out visitor to `/login` - prefetches the destination too, so the tap
|
|
87
|
+
asks for nothing.
|
|
144
88
|
|
|
145
89
|
## Showing progress
|
|
146
90
|
|
|
91
|
+
`useLinkStatus` reports whether the nearest `Link` is loading:
|
|
92
|
+
|
|
147
93
|
```tsx
|
|
148
94
|
'use client'
|
|
149
|
-
|
|
150
95
|
import { useLinkStatus } from '@rsc-kit/core/useLinkStatus'
|
|
151
96
|
|
|
152
97
|
function Spinner() {
|
|
@@ -156,44 +101,70 @@ function Spinner() {
|
|
|
156
101
|
}
|
|
157
102
|
```
|
|
158
103
|
|
|
159
|
-
A `
|
|
104
|
+
A `Link` also has a `data-pending` attribute while it loads. For what the new
|
|
105
|
+
page shows while its data arrives, see
|
|
106
|
+
[showing a loading state](/guides/routing#showing-a-loading-state).
|
|
160
107
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
108
|
+
## Refreshing the current page
|
|
109
|
+
|
|
110
|
+
```tsx
|
|
111
|
+
'use client'
|
|
112
|
+
import { refresh } from '@rsc-kit/core/router'
|
|
113
|
+
|
|
114
|
+
<button onClick={() => refresh()}>Reload</button>
|
|
165
115
|
```
|
|
166
116
|
|
|
167
|
-
|
|
117
|
+
```ts
|
|
118
|
+
refresh() // the page, leaving the layouts mounted
|
|
119
|
+
refresh('all') // the whole document, layouts included
|
|
120
|
+
refresh('orders') // one section or parallel slot
|
|
121
|
+
```
|
|
168
122
|
|
|
169
|
-
The
|
|
170
|
-
|
|
171
|
-
that window used to be the browser's: a document load of a page the router
|
|
172
|
-
would have swapped in, which is why a first tap on a slow connection felt
|
|
173
|
-
like a full reload. The bootstrap script now listens before anything else
|
|
174
|
-
loads: a tap on a `<Link>` is held, and the moment the router is wired it is
|
|
175
|
-
navigated to. If the runtime never arrives, the browser gets the tap back
|
|
176
|
-
after four seconds as a document load. Only `<Link>`s are held — a plain
|
|
177
|
-
anchor, a `route.ts`, a file, a `mailto:` are the browser's as before.
|
|
123
|
+
The scroll positions are restored afterwards: the window's, and any element
|
|
124
|
+
that scrolls on its own, such as a sidebar.
|
|
178
125
|
|
|
179
|
-
|
|
180
|
-
hydration React renders it to post natively, so a page reloads with the
|
|
181
|
-
action applied — right with no JavaScript, and a full reload with JavaScript
|
|
182
|
-
a second away. Submitted in that window, the form waits for hydration and is
|
|
183
|
-
submitted again to the handler React then has on it; a tap on a link after
|
|
184
|
-
it wins, since the visitor left the form. With no runtime after three
|
|
185
|
-
seconds, it posts natively as before.
|
|
126
|
+
## Measuring a navigation
|
|
186
127
|
|
|
128
|
+
Every navigation leaves marks on the browser's timeline, which the Performance
|
|
129
|
+
panel of any dev tools shows:
|
|
187
130
|
|
|
188
|
-
|
|
131
|
+
| Mark | When |
|
|
132
|
+
| --- | --- |
|
|
133
|
+
| `rsc-kit:navigate:start` | the click |
|
|
134
|
+
| `rsc-kit:navigate:decoded` | the page decoded, and its client code loaded |
|
|
135
|
+
| `rsc-kit:navigate:applied` | handed to React |
|
|
136
|
+
| `rsc-kit:navigate` (measure) | from the click to the page on screen |
|
|
189
137
|
|
|
190
|
-
|
|
191
|
-
'use client'
|
|
138
|
+
In a console, after a few clicks:
|
|
192
139
|
|
|
193
|
-
|
|
140
|
+
```js
|
|
141
|
+
performance.getEntriesByName('rsc-kit:navigate').map((m) => Math.round(m.duration))
|
|
142
|
+
```
|
|
194
143
|
|
|
195
|
-
|
|
144
|
+
- **A gap before `decoded`** is the network or the code: the page wasn't
|
|
145
|
+
prefetched, or was never decoded, as with a scripted click or
|
|
146
|
+
`prefetch={false}`.
|
|
147
|
+
- **A gap after `applied`** is rendering the page on that device.
|
|
148
|
+
|
|
149
|
+
On an iPhone, Safari's Web Inspector (Develop → your iPhone → the page) shows
|
|
150
|
+
the same marks in its Timelines tab.
|
|
151
|
+
|
|
152
|
+
When the router does a full document load instead - a `route.ts`, a URL in
|
|
153
|
+
`backendPaths`, another site, a newer build, a file the deploy no longer
|
|
154
|
+
serves - it says why first, with a `rsc-kit:document-load` event:
|
|
155
|
+
|
|
156
|
+
```js
|
|
157
|
+
window.addEventListener('rsc-kit:document-load', (e) => console.log(e.detail))
|
|
196
158
|
```
|
|
197
159
|
|
|
198
|
-
|
|
199
|
-
|
|
160
|
+
## Clicks before the page has loaded its JavaScript
|
|
161
|
+
|
|
162
|
+
A tap on a `<Link>` before the page's JavaScript is running is held, and
|
|
163
|
+
navigated the moment the router is ready. If it never becomes ready, the
|
|
164
|
+
browser gets the tap back after four seconds as a normal page load. Only
|
|
165
|
+
`<Link>`s are held: a plain `<a>`, a `route.ts`, a file and `mailto:` behave
|
|
166
|
+
as usual.
|
|
167
|
+
|
|
168
|
+
A form whose action is a server action is held the same way and submitted once
|
|
169
|
+
the page is ready. If the page isn't ready after three seconds, the form posts
|
|
170
|
+
the way a form with no JavaScript does. A tap on a link after submitting wins.
|
package/guides/no-javascript.md
CHANGED
|
@@ -2,54 +2,43 @@
|
|
|
2
2
|
|
|
3
3
|
> The default is none. A client component is how a page asks for it.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
A page ships no JavaScript until something on it needs some. A marketing page,
|
|
6
|
+
a changelog, an article or a policy is stored as HTML, with no React and no
|
|
7
|
+
router. The build says so on the route's line:
|
|
8
8
|
|
|
9
9
|
```
|
|
10
10
|
○ /about no js
|
|
11
11
|
no client components, so ships no javascript; stylesheet inlined
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
the
|
|
41
|
-
|
|
42
|
-
Every other stored page gets the same, shells included. One that hydrates
|
|
43
|
-
keeps its `<link>` as well, turned to `media="print"`: React looks for its
|
|
44
|
-
stylesheets by href and would fetch a missing one again. The browser loads
|
|
45
|
-
the print link at the lowest priority without holding up a paint, and never
|
|
46
|
-
applies it on screen. A page rendered per request is not stored, and keeps
|
|
47
|
-
its link.
|
|
48
|
-
|
|
49
|
-
The default is not always the right call. A site of many small pages — a
|
|
50
|
-
blog, documentation — may prefer one stylesheet the browser caches once over
|
|
51
|
-
the same 4 kB repeated in every document, and a sheet just over the cap may
|
|
52
|
-
be worth inlining anyway. It is one setting on the plugin:
|
|
14
|
+
## When a page gets JavaScript
|
|
15
|
+
|
|
16
|
+
A page gets the runtime when its tree has one of these:
|
|
17
|
+
|
|
18
|
+
- a client component (`"use client"`), such as a counter, a `<Link>` or an
|
|
19
|
+
update prompt
|
|
20
|
+
- a form with a server action, `<form action={serverFn}>`
|
|
21
|
+
- a Suspense boundary left to fill after the page arrives
|
|
22
|
+
|
|
23
|
+
There is no setting for it in either direction. The check reads the rendered
|
|
24
|
+
tree, not the source, so a client component in a shared layout counts. Most
|
|
25
|
+
pages under a layout with a `<Link>` in its header keep the runtime. A
|
|
26
|
+
[route group](/guides/routing#route-groups) with its own plain layout drops it.
|
|
27
|
+
|
|
28
|
+
Only a page stored whole can have none. A partial prerender has holes to fill
|
|
29
|
+
after the shell arrives, and a page rendered per request is not stored, so both
|
|
30
|
+
keep the runtime.
|
|
31
|
+
|
|
32
|
+
## Keeping a page this way
|
|
33
|
+
|
|
34
|
+
To make sure a page stays without JavaScript, check the build report in CI. A
|
|
35
|
+
route's `clientJs` in `build-report.json` is `null` when it shipped none.
|
|
36
|
+
|
|
37
|
+
## Stylesheets
|
|
38
|
+
|
|
39
|
+
A page's stylesheet is inlined into the document when it is at most 10 kB
|
|
40
|
+
gzipped, so the first paint waits for nothing but the document. The build says
|
|
41
|
+
so on the route's line. Change it with one setting:
|
|
53
42
|
|
|
54
43
|
```ts title="vite.config.ts"
|
|
55
44
|
rscKit({ inlineStylesheets: 'auto' }) // the default: when at most 10 kB gzipped
|
|
@@ -58,21 +47,24 @@ rscKit({ inlineStylesheets: true }) // always, whatever the size
|
|
|
58
47
|
rscKit({ inlineStylesheets: 24_000 }) // your own cap, in gzipped bytes
|
|
59
48
|
```
|
|
60
49
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
page that
|
|
50
|
+
A site of many small pages, such as a blog or documentation, may prefer one
|
|
51
|
+
stylesheet the browser caches once to the same 4 kB in every document.
|
|
52
|
+
|
|
53
|
+
- Every stored page is inlined, shells included.
|
|
54
|
+
- A page that hydrates keeps its `<link>` too, as `media="print"`: React looks
|
|
55
|
+
for its stylesheets by href and would otherwise fetch the file again. The
|
|
56
|
+
browser loads it at the lowest priority and never applies it on screen.
|
|
57
|
+
- A page rendered per request keeps its link.
|
|
66
58
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
elsewhere that points *at* it still fetches its flight payload and swaps the
|
|
70
|
-
segment, because that payload is written from the render with the runtime.
|
|
59
|
+
Fonts are left to you, since only you know which face the first paint needs.
|
|
60
|
+
The [fonts guide](/guides/fonts) shows the two-line preload.
|
|
71
61
|
|
|
72
|
-
##
|
|
62
|
+
## What still works
|
|
73
63
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
64
|
+
- **The [service worker](/guides/offline) registers** when the app has one. Its
|
|
65
|
+
one-line registration is inlined, so a visitor who lands here first still
|
|
66
|
+
gets the worker. The update prompt is a client component, so a page that
|
|
67
|
+
shows it has the runtime.
|
|
68
|
+
- **Navigation works both ways.** The page's own links are ordinary anchors,
|
|
69
|
+
which load the next page in full. A `<Link>` on another page that points here
|
|
70
|
+
still navigates to it without a reload.
|