Files
Epicnabbo-Catalogus-Updated…/src/components/admin/studio
openhandsandClaude Opus 4.8 28ce0f911c fix(catalog): keep the live catalog truthful after every import path
The live catalog store only covered part of the import surface. A durable
job settled, a sync queue drained, a .nitro upload or a clone run left the
Studio rail and the stats bar showing pre-import numbers until the page was
reloaded, and the Catalog Manager kept a second tree that never saw writes
made elsewhere in the session.

Every one of those paths now pulls the tree again, and the refresh carries
the totals with it: importing writes catalog rows server-side, so the counts
the store holds were stale for the rest of the session.

- refreshCatalogTree shares one request between concurrent callers and queues
  a single follow-up read when a write lands mid-flight, so a burst of edits
  costs at most one extra read.
- useFurnitureJobs treats its first payload as a baseline, so a page load no
  longer replays every past import as "just settled", and hands the settled
  jobs to the callback.
- The Catalog Manager pushes its own mutations into the store and re-reads its
  active tab when the store changes.
- The 30s unstable_cache on the admin totals is now tagged and invalidated from
  every catalog write, including the import worker, so it no longer survives an
  import even across a hard reload.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-09-30 14:45:26 +02:00
..

Catalog Studio code map

studio-client.tsx composes the workspace, selection and actions. Keep reusable data handling outside its render tree.

Client responsibilities

  • studio-filters.ts: pure filtering and sorting of the loaded furniture list; never mutates the input array.
  • use-studio-translations.ts: language selection, persisted defaults and translation requests.
  • use-furniture-jobs.ts: queue submission, retry identity, polling and completion notifications.
  • furniture-jobs.tsx: job history and retry controls.
  • use-furniture-inspection.ts: cancellable inspection requests and explicit rechecks.
  • furniture-inspector.tsx: local component status, source comparison and repair controls.
  • import-review.tsx: import review, actionable review groups and attachment confirmation.
  • import-recommendation.ts: completion, conflict and verification recommendations from inspected component evidence.
  • studio-types.ts: shared client data types.

Server responsibilities

  • src/lib/services/furniture-inspection.ts: reads SQL, catalog offers, furnidata and asset presence.
  • src/lib/furni/studio-inspection.ts: shared validation, comparison and completeness classification.
  • src/lib/services/furniture-repair.ts: preflight, preservation options and post-repair verification.
  • src/lib/services/furni-job-worker.ts: durable queued work and per-item results.

Keep client modules free of filesystem/database imports. Background refreshes must not reset open editors or unsaved input. Completion status must come from verification, not optimistic UI flags.

Detail navigation keeps the mounted workspace state and restores the list scroll position and originating control on close. Escape closes an open detail before clearing selection. Furniture responses must belong to the latest list request; source changes invalidate pending detail, review and delete state. Selection is never persisted outside the mounted workspace.