foldkit-remote 0.14.1 → 0.16.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/README.md +30 -1
- package/dist/{index-CXAGo7Dz.d.mts → index-eVkkbhPA.d.mts} +1624 -1610
- package/dist/index-eVkkbhPA.d.mts.map +1 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -2
- package/dist/port.d.mts +2 -2
- package/dist/port.d.mts.map +1 -1
- package/dist/port.mjs +1 -1
- package/dist/{src-CcPPtNuH.mjs → src-oVKXbiTu.mjs} +84 -49
- package/dist/src-oVKXbiTu.mjs.map +1 -0
- package/package.json +12 -11
- package/dist/index-CXAGo7Dz.d.mts.map +0 -1
- package/dist/src-CcPPtNuH.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -887,6 +887,32 @@ rendering it loading. A read the server leaves unanswered settles as missing,
|
|
|
887
887
|
so it ends the loop; what runs out the passes is a chain whose every read
|
|
888
888
|
reveals one more.
|
|
889
889
|
|
|
890
|
+
### Preloading a destination from `update`
|
|
891
|
+
|
|
892
|
+
`prefetch` and `satisfy` return a Model, which suits a render that has none
|
|
893
|
+
yet. A running application has one, and it moves on while a read is out, so
|
|
894
|
+
writing the returned Model back would undo what happened meanwhile.
|
|
895
|
+
`Data.preload` is `satisfy` as a Command: it reads what `actives` would read
|
|
896
|
+
in the Model you give it (the live one with the route set to where the reader
|
|
897
|
+
may go) and yields one `Preloaded`, carrying the Messages that wrote it,
|
|
898
|
+
which `update` reduces into the Model as it is by then:
|
|
899
|
+
|
|
900
|
+
```ts
|
|
901
|
+
const project = Surface.at(ProjectPage, model =>
|
|
902
|
+
model.route._tag === 'project' ? Option.some({ projectId: model.route.projectId }) : Option.none(),
|
|
903
|
+
)
|
|
904
|
+
// The reader is over the link to p2: read its page before they arrive.
|
|
905
|
+
const preload = Data.preload({ ...model, route: { _tag: 'project', projectId: 'p2' } }, { project })
|
|
906
|
+
// update returns { model, commands: [preload] }; under Remote.fold, foldData.preload(...)
|
|
907
|
+
```
|
|
908
|
+
|
|
909
|
+
It never fails: a read that fails, or a client that dies, ends it with what
|
|
910
|
+
was read before, and the destination reads the rest when the reader arrives.
|
|
911
|
+
A Surface of another application is refused when the Command is made. What it
|
|
912
|
+
reads is kept like any other read until what is retained next changes, so
|
|
913
|
+
preload close to the navigation you expect (a hover, a focus), not far ahead
|
|
914
|
+
of it.
|
|
915
|
+
|
|
890
916
|
### Refreshing from `update`
|
|
891
917
|
|
|
892
918
|
To revalidate what a screen already declares — a refresh button, a focus
|
|
@@ -2127,4 +2153,7 @@ Remote does **not** own:
|
|
|
2127
2153
|
- [`examples/remote`](../../examples/remote) — an asserted trace through plan,
|
|
2128
2154
|
prefetch, refresh, query, render, mutation, retention, and decode failure.
|
|
2129
2155
|
- [`examples/kitchen-sink`](../../examples/kitchen-sink) — the same architecture
|
|
2130
|
-
using the real server packages.
|
|
2156
|
+
using the real server packages.
|
|
2157
|
+
- [Site, Remote and SSR together](../../docs/site-remote-ssr.md) — routes that
|
|
2158
|
+
activate reads, rendered on the server with their data and taken over without
|
|
2159
|
+
fetching again.
|