feat: consume the boot payload (load-path-rework 0001 §6, client)
useProjectBoot: the tool page tries the ONE composed boot round-trip first — its project half is the getProject shape — and falls back to the active source's getProject on any miss (older backend, local-store slug, static gallery), so downstream behavior without a payload is exactly pre-boot. With a payload: seedSessionIdentity makes the /api/me flight a resolved no-op; the synced libs source is constructed with the preloaded listing (kind-filtered client-side by kindCounts — the same org/mirror-always + libHasKind rule the server applies) and the batch-resolved stacks, and every INTERNAL listing (syncState, presync, enableRealtime name-mapping) rides the preload too; the fresh project-sync digest threads into staging so a warm restage affirms with zero HTTP. Measured warm load (Arduino repo-as-project): total API traffic = 1 boot request + the ydoc-backed per-file set — /api/me, /libs, sync-stacks and /sync/manifest all at zero. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VLSht9cadprtT2mhynawWu
This commit is contained in:
parent
314986ad36
commit
7c15f14bb8
11 changed files with 366 additions and 29 deletions
|
|
@ -311,7 +311,19 @@ export function modelsSourceConfig(): Model3dSource | null {
|
|||
: null;
|
||||
}
|
||||
|
||||
export function libsSourceConfig(projectId?: string): LibsSource | null {
|
||||
/** The boot payload's lib hand-over (see wasm/libs/synced-source.ts). */
|
||||
export interface LibsBootPreload {
|
||||
libs: import("@/wasm/libs/synced-source").PreloadedLibDto[];
|
||||
stacks: Record<
|
||||
string,
|
||||
import("@pcbjam/shared").SyncStackDescriptor | null
|
||||
>;
|
||||
}
|
||||
|
||||
export function libsSourceConfig(
|
||||
projectId?: string,
|
||||
preload?: LibsBootPreload,
|
||||
): LibsSource | null {
|
||||
const kind = import.meta.env.VITE_LIBS_SOURCE ?? "remote";
|
||||
// "local" is the placeholder id for launches with no real backend project
|
||||
// (local folder, tool grid, lib-scoped open). It is NOT a project on the
|
||||
|
|
@ -338,6 +350,7 @@ export function libsSourceConfig(projectId?: string): LibsSource | null {
|
|||
scope: currentScope(),
|
||||
user: userSlug(),
|
||||
project,
|
||||
preloaded: preload,
|
||||
log: (m) => console.log(m),
|
||||
},
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue