fix(rcal): seed sample data for all spaces, not just demo
Auto-seed calendar sources and events on first visit to any space's rcal page, and during space creation via seedTemplate hooks. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
4f1eab3104
commit
1827b34f6b
|
|
@ -842,6 +842,8 @@ routes.get("/api/context/:tool", async (c) => {
|
||||||
routes.get("/", (c) => {
|
routes.get("/", (c) => {
|
||||||
const space = c.req.param("space") || "demo";
|
const space = c.req.param("space") || "demo";
|
||||||
const dataSpace = c.get("effectiveSpace") || space;
|
const dataSpace = c.get("effectiveSpace") || space;
|
||||||
|
// Seed sample data for any space that has no events yet
|
||||||
|
seedDemoIfEmpty(dataSpace);
|
||||||
return c.html(renderShell({
|
return c.html(renderShell({
|
||||||
title: `${space} — Calendar | rSpace`,
|
title: `${space} — Calendar | rSpace`,
|
||||||
moduleId: "rcal",
|
moduleId: "rcal",
|
||||||
|
|
|
||||||
|
|
@ -176,6 +176,17 @@ export async function createSpace(opts: CreateSpaceOpts): Promise<CreateSpaceRes
|
||||||
console.error(`[createSpace:${source}] Template seeding failed for ${slug}:`, e);
|
console.error(`[createSpace:${source}] Template seeding failed for ${slug}:`, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Seed module-specific demo data (calendar events, sample tasks, etc.)
|
||||||
|
for (const mod of getAllModules()) {
|
||||||
|
if (mod.seedTemplate) {
|
||||||
|
try {
|
||||||
|
mod.seedTemplate(slug);
|
||||||
|
} catch (e) {
|
||||||
|
console.error(`[createSpace:${source}] Module ${mod.id} seedTemplate failed for ${slug}:`, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
console.log(`[createSpace:${source}] Created space: ${slug}`);
|
console.log(`[createSpace:${source}] Created space: ${slug}`);
|
||||||
return { ok: true, slug, name, visibility, ownerDID };
|
return { ok: true, slug, name, visibility, ownerDID };
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue