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:
Jeff Emmett 2026-03-21 18:22:11 -07:00
parent 36e76449fa
commit dbe60f2711
1 changed files with 5 additions and 9 deletions

View File

@ -2037,15 +2037,11 @@ app.get("/:space/:moduleId/template", async (c) => {
import type { RSpaceModule } from "../shared/module";
import { resolveDataSpace } from "../shared/scope-resolver";
function moduleHasData(space: string, mod: RSpaceModule): boolean {
if (space === "demo") return true; // demo always has data
if (!mod.docSchemas || mod.docSchemas.length === 0) return true; // no schemas = can't detect
for (const schema of mod.docSchemas) {
if (!schema.pattern.includes('{space}')) return true; // global module, always show
const prefix = schema.pattern.replace('{space}', space).split(':').slice(0, 3).join(':');
if (syncServer.hasDocsWithPrefix(prefix)) return true;
}
return false;
function moduleHasData(_space: string, _mod: RSpaceModule): boolean {
// Always show the module's own UI — let each module handle its empty state.
// Previously demo returned true while live spaces checked for CRDT docs,
// causing live spaces to show a generic onboarding page instead of the module.
return true;
}
// ── Mount module routes under /:space/:moduleId ──