fix(editor): resolve project creation bug - missing graph structure

TASK-010: Fixed critical P0 bug preventing new project creation

Problem:
- Programmatic project.json generation had incorrect structure
- Missing 'graph' object wrapper
- Missing 'comments' and 'connections' arrays
- Error: Cannot read properties of undefined (reading 'comments')

Solution:
- Corrected project.json structure with proper graph object
- Added component id field
- Included all required arrays (roots, connections, comments)
- Added debug logging for better error tracking

Impact:
- New users can now create projects successfully
- Unblocks user onboarding
- No more cryptic error messages

Documentation:
- Added comprehensive entry to LEARNINGS.md
- Created detailed CHANGELOG.md
- Updated README.md with completion status
This commit is contained in:
Tara West
2026-01-09 10:22:48 +01:00
parent e3b682d037
commit a104a3a8d0
4 changed files with 746 additions and 26 deletions

View File

@@ -267,32 +267,35 @@ export class LocalProjectsModel extends Model {
components: [
{
name: 'App',
ports: [],
visual: true,
visualStateTransitions: [],
nodes: [
{
id: guid(),
type: 'Group',
x: 0,
y: 0,
parameters: {},
ports: [],
children: [
{
id: guid(),
type: 'Text',
x: 50,
y: 50,
parameters: {
text: 'Hello World!'
},
ports: [],
children: []
}
]
}
]
id: guid(),
graph: {
roots: [
{
id: guid(),
type: 'Group',
x: 0,
y: 0,
parameters: {},
ports: [],
children: [
{
id: guid(),
type: 'Text',
x: 50,
y: 50,
parameters: {
text: 'Hello World!'
},
ports: [],
children: []
}
]
}
],
connections: [],
comments: []
},
metadata: {}
}
],
settings: {},
@@ -307,6 +310,7 @@ export class LocalProjectsModel extends Model {
// Load the newly created project
projectFromDirectory(dirEntry, (project) => {
if (!project) {
console.error('Failed to create project from generated structure');
fn();
return;
}
@@ -315,8 +319,10 @@ export class LocalProjectsModel extends Model {
this._addProject(project);
project.toDirectory(project._retainedProjectDirectory, (res) => {
if (res.result === 'success') {
console.log('Project created successfully:', name);
fn(project);
} else {
console.error('Failed to save project to directory');
fn();
}
});