fix(fe): subscribe to capture-session store in components (was reading the store object)

`session.state` is a Svelte store; `$: state = session.state` bound the store
object (not its value), so state.capture was undefined and cap.k threw on
mount. Bind a local const to the store and use the $ prefix ($stateStore),
and use get() in App.onPhotosReady. Verified in Chromium: hero -> batch ->
sample uploads show thumbs.
This commit is contained in:
2026-09-25 07:45:25 -07:00
parent de2af5c6c7
commit 7913e630d6
3 changed files with 6 additions and 4 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
<script lang="ts">
import { onMount } from 'svelte';
import { writable } from 'svelte/store';
import { get, writable } from 'svelte/store';
import { apiFetch } from './lib/api';
import type { SlabDraft, Photo, Taxonomy } from './lib/types';
import { draft } from './lib/types';
@@ -98,7 +98,7 @@
const current = $slab;
try {
if (!current) {
const s = captureSession.state;
const s = get(captureSession.state);
const results = s.capture.k === 'measure' ? s.capture.results : null;
const d = results
? draft({
+2 -1
View File
@@ -7,7 +7,8 @@
export let session: CaptureSession;
const dispatch = createEventDispatcher<{ continue: void }>();
$: state = session.state;
const stateStore = session.state;
$: state = $stateStore;
$: items = session.lineup();
$: measure = state.capture.k === 'measure' ? state.capture : null;
$: results = measure?.results ?? null;
+2 -1
View File
@@ -6,7 +6,8 @@
export let session: CaptureSession;
const dispatch = createEventDispatcher<{ 'photos-ready': void }>();
$: state = session.state;
const stateStore = session.state;
$: state = $stateStore;
$: cap = state.capture;
$: kind = cap.k;