@frockbot/client-core 0.3.1 → 0.3.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/package.json +5 -5
  2. package/src/index.ts +20 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frockbot/client-core",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "exports": {
@@ -13,10 +13,10 @@
13
13
  "typecheck": "tsc --noEmit -p tsconfig.json"
14
14
  },
15
15
  "dependencies": {
16
- "@frockbot/configuration-core": "0.3.1",
17
- "@frockbot/connection-core": "0.3.1",
18
- "@frockbot/kernel-contracts": "0.3.1",
19
- "@frockbot/protocol": "0.3.1",
16
+ "@frockbot/configuration-core": "0.3.2",
17
+ "@frockbot/connection-core": "0.3.2",
18
+ "@frockbot/kernel-contracts": "0.3.2",
19
+ "@frockbot/protocol": "0.3.2",
20
20
  "vue": "3.5.41"
21
21
  },
22
22
  "devDependencies": {
package/src/index.ts CHANGED
@@ -23,6 +23,7 @@ import {
23
23
  defineComponent,
24
24
  Fragment,
25
25
  h,
26
+ shallowReactive,
26
27
  type App,
27
28
  type Component,
28
29
  type ComputedRef,
@@ -376,6 +377,12 @@ export interface ClientSlotRegistration {
376
377
  slot: string;
377
378
  order: number;
378
379
  component: Component;
380
+ /**
381
+ * A stable key for one filler, so a slot whose fillers come from data —
382
+ * a Package's declared entries, say — keeps each filler's element across a
383
+ * re-render instead of reusing the one that happens to share its order.
384
+ */
385
+ key?: string;
379
386
  }
380
387
 
381
388
  export interface ClientSurfaceRegistration {
@@ -428,7 +435,15 @@ function disposeResult(result: ClientPluginResult): void {
428
435
  }
429
436
 
430
437
  export class ClientApplication {
431
- private readonly registrations: ClientSlotRegistration[] = [];
438
+ /*
439
+ * Reactive, because a slot filler is not always known at install time: a
440
+ * Package's declarative entries arrive with the Bot's Composition and are
441
+ * registered and disposed as it changes. A plain array would leave the
442
+ * sidebar showing the entries of whichever Bot was selected first.
443
+ */
444
+ private readonly registrations: ClientSlotRegistration[] = shallowReactive(
445
+ [],
446
+ );
432
447
  private readonly providers: ProviderRegistration[] = [];
433
448
  private readonly pluginDisposers: (() => void)[] = [];
434
449
  private app: App | undefined;
@@ -464,9 +479,11 @@ export class ClientApplication {
464
479
  setup: (props: { name: string }) => () =>
465
480
  h(
466
481
  Fragment,
467
- this.slots(props.name).map((registration) =>
482
+ this.slots(props.name).map((registration, index) =>
468
483
  h(registration.component, {
469
- key: `${props.name}:${registration.order}`,
484
+ key:
485
+ registration.key ??
486
+ `${props.name}:${registration.order}:${index}`,
470
487
  }),
471
488
  ),
472
489
  ),