mirror of
https://github.com/The-Low-Code-Foundation/OpenNoodl.git
synced 2026-01-13 07:42:55 +01:00
2.0 KiB
2.0 KiB
BUG-003: "Make Home" Context Menu Does Nothing
Severity: 🔴 CRITICAL
Status: Root Cause Identified (Same as BUG-002)
Category: Core Functionality
🐛 Symptom
When right-clicking on App component and selecting "Make Home":
- ❌ Nothing happens
- ❌ No console output
- ❌ No error messages
- ❌ Component doesn't become Home
Expected: App should be set as Home, preview should work.
Actual: Silent failure, no feedback.
🔍 Root Cause
Same as BUG-002: Router node missing allowAsExportRoot: true
The Code Path
-
User clicks "Make Home" in context menu
-
Handler is called correctly:
// useComponentActions.ts:27
const handleMakeHome = useCallback((node: TreeNode) => {
const component = node.data.component;
ProjectModel.instance?.setRootComponent(component); // ← This is called!
}, []);
- setRootComponent() FAILS SILENTLY:
// projectmodel.ts:233
setRootComponent(component: ComponentModel) {
const root = _.find(component.graph.roots, function (n) {
return n.type.allowAsExportRoot; // ❌ Returns undefined for Router!
});
if (root) this.setRootNode(root); // ❌ Never reaches here
// ❌ NO ERROR, NO LOG, NO FEEDBACK
}
💡 Why It's Silent
The method doesn't throw errors or log anything. It just:
- Searches for a node with
allowAsExportRoot: true - Finds nothing (Router doesn't have it)
- Exits quietly
No one knows it failed!
🛠️ Solution
Same fix as BUG-002: Add allowAsExportRoot: true to Router node.
// packages/noodl-viewer-react/src/nodes/navigation/router.tsx
const RouterNode = {
name: 'Router',
displayNodeName: 'Page Router',
allowAsExportRoot: true // ✅ ADD THIS LINE
// ...
};
✅ Verification
After fix:
- Create new project
- Right-click App component
- Click "Make Home"
- App should get home icon
- Preview should work
Priority: P0 - MUST FIX IMMEDIATELY
Fixes With: BUG-002 (same root cause, same solution)