snapback4 0.0.11 → 0.0.12

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/client.js CHANGED
@@ -213,6 +213,13 @@ export function createClient(options) {
213
213
  subscribe(notifyMe) {
214
214
  mine.add(notifyMe);
215
215
  own.subscribers.add(notifyMe);
216
+ // A screen that closed this key a moment ago (React unmounts the
217
+ // old component before the new one subscribes) may have removed
218
+ // the watch: put it back, and refresh it.
219
+ if (watches.get(own.key) !== own) {
220
+ watches.set(own.key, own);
221
+ void refresh(own);
222
+ }
216
223
  return () => {
217
224
  mine.delete(notifyMe);
218
225
  own.subscribers.delete(notifyMe);
package/dist/local.js CHANGED
@@ -284,6 +284,14 @@ export async function createLocalClient(options) {
284
284
  subscribe(listener) {
285
285
  mine.add(listener);
286
286
  own.subscribers.add(listener);
287
+ // A screen that closed this key a moment ago (React unmounts the
288
+ // old component before the new one subscribes) may have removed
289
+ // the watch: put it back, and refresh it, so no subscriber is
290
+ // left on a watch nothing updates.
291
+ if (watches.get(own.key) !== own) {
292
+ watches.set(own.key, own);
293
+ void rerun(own);
294
+ }
287
295
  return () => { mine.delete(listener); own.subscribers.delete(listener); };
288
296
  },
289
297
  close() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "snapback4",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "type": "module",
5
5
  "description": "Snapback 4: the card (contract), the online and local-first clients (IndexedDB, SQLite), React hooks, sign-in, a labelled mock, and the `snapback4` CLI. LLP 3000.",
6
6
  "bin": {
@@ -42,7 +42,7 @@
42
42
  "README.md"
43
43
  ],
44
44
  "optionalDependencies": {
45
- "snapback4-darwin-arm64": "0.0.11"
45
+ "snapback4-darwin-arm64": "0.0.12"
46
46
  },
47
47
  "scripts": {
48
48
  "build": "tsc -p tsconfig.build.json",