@inflatable-cookie/longhorn-poodle-svelte 0.1.0 → 0.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inflatable-cookie/longhorn-poodle-svelte",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -151,7 +151,7 @@
151
151
  "LICENSE"
152
152
  ],
153
153
  "peerDependencies": {
154
- "@inflatable-cookie/longhorn": "0.1.0",
154
+ "@inflatable-cookie/longhorn": "0.2.0",
155
155
  "@inflatable-cookie/poodle-core": "0.4.2",
156
156
  "@inflatable-cookie/poodle-svelte": "0.4.2",
157
157
  "svelte": ">=5.38.6 <=5.56.8"
@@ -40,6 +40,7 @@ export class SettingsSessionDocument {
40
40
  #registry = $state.raw<SettingsRegistrySnapshot | undefined>(undefined);
41
41
  #projection = $state.raw<SettingsRegistryProjection | undefined>(undefined);
42
42
  #route = $state.raw<SettingsRoute | undefined>(undefined);
43
+ #routeGeneration = 0;
43
44
  #focusRevision = $state(0);
44
45
  #renderers = new Map<string, SettingsPageRenderer>();
45
46
  #scopes = new Map<SettingsScopeId, SettingsScopeState>();
@@ -125,17 +126,26 @@ export class SettingsSessionDocument {
125
126
  async installRoute(route: SettingsRoute): Promise<void> {
126
127
  const registry = this.requiredRegistry();
127
128
  const { page } = resolveSettingsDeepLink(registry, route);
129
+ // Scopes start asynchronously, so a route with scopes can commit after a
130
+ // later navigation that had none. A renderer-only page exposes it: it
131
+ // commits immediately, then the scopes of the page it was navigated away
132
+ // from finish and overwrite it. Last navigation wins, not last scope to
133
+ // settle.
134
+ const generation = ++this.#routeGeneration;
128
135
  await Promise.all(
129
136
  page.readableScopeIds.map((scopeId) =>
130
137
  this.#scopeState(registry, scopeId).start(),
131
138
  ),
132
139
  );
140
+ if (generation !== this.#routeGeneration) return;
133
141
  this.#route = route;
134
142
  this.#pageSession(page);
135
143
  this.#focusRevision += 1;
136
144
  }
137
145
 
138
146
  async clearAuthority(): Promise<void> {
147
+ // Any route install still awaiting its scope starts is superseded.
148
+ this.#routeGeneration += 1;
139
149
  for (const page of this.#pages.values()) {
140
150
  page.stop();
141
151
  }
@@ -34,7 +34,11 @@
34
34
 
35
35
  function install(): void {
36
36
  const version = update.actionableVersion;
37
- if (version !== undefined) void controller.install(version);
37
+ if (version === undefined) return;
38
+ // Two halves of one button. A retained artifact is applied; anything else
39
+ // is staged first, and the surface's progress then says when to restart.
40
+ if (update.progress?.state === "readyToInstall") void controller.apply(version);
41
+ else void controller.prepare(version);
38
42
  }
39
43
 
40
44
  function defer(): void {
@@ -23,7 +23,11 @@
23
23
 
24
24
  function install(): void {
25
25
  const version = update.actionableVersion;
26
- if (version !== undefined) void controller.install(version);
26
+ if (version === undefined) return;
27
+ // Two halves of one button. A retained artifact is applied; anything else
28
+ // is staged first, and the surface's progress then says when to restart.
29
+ if (update.progress?.state === "readyToInstall") void controller.apply(version);
30
+ else void controller.prepare(version);
27
31
  }
28
32
 
29
33
  // "Not now", which is the operator's own decision rather than the gate's.