mirror of
https://github.com/The-Low-Code-Foundation/OpenNoodl.git
synced 2026-01-14 00:02:57 +01:00
2.4 KiB
2.4 KiB
BUG-002: App Component Not Set as Home
Severity: 🔴 CRITICAL
Status: Root Cause Identified
Category: Core Functionality
🐛 Symptom
After creating a new project:
- ❌ Preview shows error: "No 🏠 HOME component selected"
- ❌ App component is not marked as Home in Components panel
- ❌
ProjectModel.instance.rootNodeisundefined
Expected: App component should be automatically set as Home, preview should work.
Actual: No home component is set, preview fails.
🔍 Root Cause
Router node is missing allowAsExportRoot: true
The Problem Chain
- Template includes
rootComponent:
// hello-world.template.ts
content: {
rootComponent: 'App', // ✅ This is correct
components: [...]
}
- ProjectModel.fromJSON() tries to set it:
// projectmodel.ts:172
if (json.rootComponent && !_this.rootNode) {
const rootComponent = _this.getComponentWithName(json.rootComponent);
if (rootComponent) {
_this.setRootComponent(rootComponent); // ← Calls the broken method
}
}
- setRootComponent() SILENTLY FAILS:
// projectmodel.ts:233
setRootComponent(component: ComponentModel) {
const root = _.find(component.graph.roots, function (n) {
return n.type.allowAsExportRoot; // ❌ Router returns undefined!
});
if (root) this.setRootNode(root); // ❌ NEVER EXECUTES!
// NO ERROR THROWN - Silent failure!
}
- Router node has NO
allowAsExportRoot:
// packages/noodl-viewer-react/src/nodes/navigation/router.tsx
const RouterNode = {
name: 'Router'
// ❌ MISSING: allowAsExportRoot: true
// ...
};
💥 Impact
This is a BLOCKER:
- New projects cannot be previewed
- Users see cryptic error message
- "Make Home" button also fails (same root cause)
- No console errors to debug
🛠️ Solution
Add one line to router.tsx:
const RouterNode = {
name: 'Router',
displayNodeName: 'Page Router',
allowAsExportRoot: true, // ✅ ADD THIS
category: 'Visuals'
// ...
};
That's it! This single line fixes both Bug #2 and Bug #3.
✅ Verification
After fix:
- Create new project
- Check Components panel - App should have home icon
- Open preview - should show "Hello World!"
- No error messages
Priority: P0 - MUST FIX IMMEDIATELY
Blocks: All new project workflows