@relyio/sdk 0.8.0 → 0.9.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/CHANGELOG.md CHANGED
@@ -1,5 +1,36 @@
1
1
  # @relyio/sdk
2
2
 
3
+ ## 0.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 187624c: **`<RelyIOProvider live>` no longer misses a publish that lands while the page is loading.** The provider used to send its reads first and open the feed afterwards, from the feed's position at that moment — so anything published in between was in neither, and the page showed the old content until that entry changed again. With `live` on, the reads beneath the provider now wait until the feed has opened and sent its position — the first thing it sends, so there is no extra request and the edge counts your visitor once — and then go; anything published after that position is announced and refetched like any other change. The same holds after a connection that failed before it had a position: everything is refetched once the new one has sent its position. If the feed fails before it has one — it is down, or refuses the key — the reads are sent without it, so content never waits on a feed that is down. A server render is unchanged: its reads never wait. Nothing to change in your code, but `@relyio/react` now needs `@relyio/sdk` 0.9.0 or later, the release that carries this.
8
+
9
+ **A socket that neither opens nor fails is given up after fifteen seconds.** `liveChanges()` used to wait on such a socket — a network that holds the upgrade without refusing it — for as long as the page was open. It now closes a socket that has not opened and been told its position within `LIVE_SOCKET_OPEN_TIMEOUT_MS` (the poll interval, fifteen seconds; newly exported) and polls the edge from the same cursor instead, as it does for a socket that fails to open. That also bounds how long the provider's first reads wait.
10
+
11
+ **Read after the feed's position, with no request of your own for it.** Opened without `since`, `liveChanges()` and `changes()` hand the position they start from to `reached` before anything after it — the edge's `feed.opened` or first poll's answer; `/v1/changes`' first answer. `ChangesOptions` gains `reached` for this; `changes()` calls it once, with that head, and never with a later page's cursor — so `followChanges()` over `changes()` now reopens from that head after a failure before the first change, rather than refetching everything. Read what you show after that call, and a publish your read did not see is announced. With `followChanges()`, which hands the source its own `reached`, call both:
12
+
13
+ ```ts
14
+ let positioned!: () => void
15
+ const position = new Promise<void>(resolve => (positioned = resolve))
16
+ const following = followChanges(
17
+ from =>
18
+ relyio.liveChanges({
19
+ ...from,
20
+ ids: [id],
21
+ reached: cursor => {
22
+ from.reached(cursor)
23
+ positioned()
24
+ },
25
+ }),
26
+ { signal, onChange, onResync, onState: state => state.kind !== 'following' && positioned() },
27
+ )
28
+ await position
29
+ const post = await relyio.content('post').findById(id).execute()
30
+ ```
31
+
32
+ `changesHead()` still takes the position with a request of its own, for a feed you open later.
33
+
3
34
  ## 0.8.0
4
35
 
5
36
  ### Minor Changes