fix(onboarding): remove moduleHasData gate so live spaces show module UI
Live spaces with no CRDT data were showing a generic onboarding page instead of the module's actual UI. Demo always bypassed this check, causing visual parity issues between demo.rspace.online and live spaces. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
36e76449fa
commit
dbe60f2711
|
|
@ -2037,15 +2037,11 @@ app.get("/:space/:moduleId/template", async (c) => {
|
||||||
import type { RSpaceModule } from "../shared/module";
|
import type { RSpaceModule } from "../shared/module";
|
||||||
import { resolveDataSpace } from "../shared/scope-resolver";
|
import { resolveDataSpace } from "../shared/scope-resolver";
|
||||||
|
|
||||||
function moduleHasData(space: string, mod: RSpaceModule): boolean {
|
function moduleHasData(_space: string, _mod: RSpaceModule): boolean {
|
||||||
if (space === "demo") return true; // demo always has data
|
// Always show the module's own UI — let each module handle its empty state.
|
||||||
if (!mod.docSchemas || mod.docSchemas.length === 0) return true; // no schemas = can't detect
|
// Previously demo returned true while live spaces checked for CRDT docs,
|
||||||
for (const schema of mod.docSchemas) {
|
// causing live spaces to show a generic onboarding page instead of the module.
|
||||||
if (!schema.pattern.includes('{space}')) return true; // global module, always show
|
return true;
|
||||||
const prefix = schema.pattern.replace('{space}', space).split(':').slice(0, 3).join(':');
|
|
||||||
if (syncServer.hasDocsWithPrefix(prefix)) return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Mount module routes under /:space/:moduleId ──
|
// ── Mount module routes under /:space/:moduleId ──
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue