Update stateManager.js
Browse files- stateManager.js +11 -7
stateManager.js
CHANGED
|
@@ -217,15 +217,19 @@ export const StateManager = {
|
|
| 217 |
const mergedInfo = { ...currentDb.info, ...payload.info };
|
| 218 |
delete mergedInfo.commandQueue;
|
| 219 |
|
| 220 |
-
// Update JSON
|
| 221 |
-
const { error } = await supabase.from('projects')
|
| 222 |
-
.update({
|
| 223 |
-
info: mergedInfo,
|
| 224 |
-
updated_at: now
|
| 225 |
-
})
|
| 226 |
.eq('id', projectId);
|
| 227 |
|
| 228 |
-
if (
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 229 |
}
|
| 230 |
},
|
| 231 |
|
|
|
|
| 217 |
const mergedInfo = { ...currentDb.info, ...payload.info };
|
| 218 |
delete mergedInfo.commandQueue;
|
| 219 |
|
| 220 |
+
// 1. Update info JSON (including status and last_edited)
|
| 221 |
+
const { error: infoError } = await supabase.from('projects')
|
| 222 |
+
.update({ info: mergedInfo })
|
|
|
|
|
|
|
|
|
|
| 223 |
.eq('id', projectId);
|
| 224 |
|
| 225 |
+
if (infoError) console.error("[DB ERROR] Update Project Info failed:", infoError.message);
|
| 226 |
+
|
| 227 |
+
// 2. Try updating root column for sorting
|
| 228 |
+
try {
|
| 229 |
+
await supabase.from('projects').update({ updated_at: now }).eq('id', projectId);
|
| 230 |
+
} catch (e) {
|
| 231 |
+
// Ignore if column doesn't exist
|
| 232 |
+
}
|
| 233 |
}
|
| 234 |
},
|
| 235 |
|