@opetope/react 0.12.1 → 0.12.2

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.
Files changed (2) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/package.json +5 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,67 @@
1
1
  # @opetope/react
2
2
 
3
+ ## 0.12.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 2d1ecfc: Two axes of a Resource state, not one word (D462)
8
+
9
+ `ResourceState` carries two independent fields, `failure` and `pending`, and each is declared on every member of the
10
+ union — `?: never` where the member cannot hold one. Both are therefore read on the whole state in one step, without
11
+ narrowing by `kind` first:
12
+
13
+ ```ts
14
+ const refused = state.failure !== undefined;
15
+ const working = state.kind === 'loading' || state.pending !== undefined;
16
+ ```
17
+
18
+ `ResourceActivity` is gone, `ResourceChannelFailure` is now `ResourceFailure` with an optional `channel`, and
19
+ `failed` carries `failure` instead of a top-level `error`.
20
+
21
+ **Why.** One frequent question — «did something fail?» — was asked in three shapes: `failed.error`,
22
+ `loading.failure`, and `ready.activity.kind === 'failed'`. «Is something in flight?» was asked in two. Both are one
23
+ read each now.
24
+
25
+ **What changes in behaviour.** The priority within an axis is unchanged: at an equal kind the connection outranks
26
+ the refresh. The priority _between_ the axes is gone — a failed channel no longer hides a working one, so a `ready`
27
+ record publishes a dead connection and a running refresh together. That is more information, not less, and it is the
28
+ difference between «the live stream is gone, what is shown will not update» and «a manual reload is running over a
29
+ live stream».
30
+
31
+ `pending` is observable structure, so **every transition of the work axis now publishes a record**. It did not
32
+ before: one projected word hid that axis on a dataless `loading`, which carried no `activity` at all, and under any
33
+ failure, because `failed` outranked `pending`. Measured on a live Resource with both channels, a connection opening
34
+ over a dataless Resource goes from 1 record to 2; a `refresh()` over a healthy `ready` from 5 to 6; and a
35
+ `refresh()` over a `ready` that already carries a dead connection from 5 to 7, because its settling used to cost no
36
+ record at all. Up to two extra publications over the life of one materialization, and they reach the subscribers of
37
+ a `ready` Resource and not only a dataless one. Each carries the fact the axes were split for.
38
+
39
+ **Migration.**
40
+
41
+ | Was | Is now |
42
+ | --------------------------------------------- | ------------------------------------------------- |
43
+ | `state.error` on `failed` | `state.failure.error` |
44
+ | `state.failure.channel` on `loading` | unchanged, and now on every kind |
45
+ | `state.activity.kind === 'failed'` | `state.failure !== undefined` |
46
+ | `state.activity.kind === 'pending'` | `state.pending !== undefined` |
47
+ | `state.activity.operation` | `state.failure?.channel` or `state.pending` |
48
+ | `state.activity.error` | `state.failure?.error` |
49
+ | `ResourceChannelFailure` from `@opetope/core` | `ResourceFailure` |
50
+ | `ResourceActivity` from `@opetope/core` | nothing: read `state.failure` and `state.pending` |
51
+
52
+ `failure.channel` is absent only on a `failed` record whose every configured channel died, where no single channel
53
+ is the answer. `opetope/no-retired-vocabulary` reports `ResourceActivity` at both entries that ever spelled it, and
54
+ reports `state.activity` wherever it is read rather than only inside a `kind === 'loading'` narrowing; the rename to
55
+ `ResourceFailure` is printed by the compiler itself.
56
+
57
+ The inspection protocol is unchanged: `opetope.runtime-activity/4` stays `/4`, and the facts now read the published
58
+ record instead of a second copy of the channel phases.
59
+
60
+ - Updated dependencies [26e6c9a]
61
+ - Updated dependencies [2d1ecfc]
62
+ - @opetope/core@0.12.2
63
+ - @opetope/runtime@0.12.2
64
+
3
65
  ## 0.12.1
4
66
 
5
67
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opetope/react",
3
- "version": "0.12.1",
3
+ "version": "0.12.2",
4
4
  "engines": {
5
5
  "node": ">=20.19.0"
6
6
  },
@@ -49,16 +49,16 @@
49
49
  }
50
50
  ],
51
51
  "devDependencies": {
52
- "@opetope/core": "0.12.1",
53
- "@opetope/runtime": "0.12.1",
52
+ "@opetope/core": "0.12.2",
53
+ "@opetope/runtime": "0.12.2",
54
54
  "@testing-library/react": "16.3.3",
55
55
  "@types/react": "19.2.18",
56
56
  "react": "19.2.8",
57
57
  "react-dom": "19.2.8"
58
58
  },
59
59
  "peerDependencies": {
60
- "@opetope/core": "0.12.1",
61
- "@opetope/runtime": "0.12.1",
60
+ "@opetope/core": "0.12.2",
61
+ "@opetope/runtime": "0.12.2",
62
62
  "react": ">=19.0.0 <20"
63
63
  },
64
64
  "sideEffects": false,