Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address review: rewrite __new_apex__ placeholders for existing apex goals

Adam Eivy6edb055ca088
diff --git a/client/src/components/goals/applyOrganization.js b/client/src/components/goals/applyOrganization.js
index 3fb0eff825..aaf83ee153 100644
--- a/client/src/components/goals/applyOrganization.js
+++ b/client/src/components/goals/applyOrganization.js
@@ -16,14 +16,6 @@ export async function applyOrganizationSuggestion(suggestion) {
}).then(res => res, () => null);
if (!apex?.id) return false;
apexId = apex.id;
- // Rewrite organization items that should parent under new apex
- if (organization) {
- for (const item of organization) {
- if (item.suggestedParentId === '__new_apex__' || (!item.suggestedParentId && item.goalType === 'sub-apex')) {
- item.suggestedParentId = apexId;
- }
- }
- }
}
// Resolve apex ID: prefer existing, fall back to newly created
@@ -31,6 +23,15 @@ export async function applyOrganizationSuggestion(suggestion) {
apexId = suggestion.apexGoal.existingId;
}
+ // Rewrite __new_apex__ placeholders and unparented sub-apex items to resolved apex
+ if (apexId && organization) {
+ for (const item of organization) {
+ if (item.suggestedParentId === '__new_apex__' || (!item.suggestedParentId && item.goalType === 'sub-apex')) {
+ item.suggestedParentId = apexId;
+ }
+ }
+ }
+
// Create suggested sub-apex goals in parallel, parented under the apex
if (suggestion.suggestedSubApex?.length) {
const results = await Promise.all(suggestion.suggestedSubApex.map(sg => {