JacobLinCool Codex commited on
Commit
e25f6ac
·
verified ·
1 Parent(s): 9eec184

fix: invalidate stale advisor results

Browse files

Co-authored-by: Codex <noreply@openai.com>

Files changed (1) hide show
  1. static/app.js +30 -0
static/app.js CHANGED
@@ -97,6 +97,7 @@ goalsEl.addEventListener("change", (event) => {
97
  );
98
  session.goals = goalOptions.filter((option) => checked.has(option));
99
  syncCurrentIdeaGoals();
 
100
  saveSession();
101
  renderGoals(session.goals);
102
  renderIdeas(session.ideas || []);
@@ -113,6 +114,7 @@ profileEl.addEventListener("input", (event) => {
113
  delete profile[target.dataset.profileField];
114
  }
115
  session.profile = profile;
 
116
  saveSession();
117
  });
118
 
@@ -880,6 +882,34 @@ function syncCurrentIdeaGoals() {
880
  if (idea) idea.goals = [...(session.goals || [])];
881
  }
882
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
883
  async function exportNotes() {
884
  await exportMarkdown({
885
  endpoint: "/field_notes",
 
97
  );
98
  session.goals = goalOptions.filter((option) => checked.has(option));
99
  syncCurrentIdeaGoals();
100
+ invalidateCurrentSeal("Goals updated. Press Ink or Plan to refresh the seal.");
101
  saveSession();
102
  renderGoals(session.goals);
103
  renderIdeas(session.ideas || []);
 
114
  delete profile[target.dataset.profileField];
115
  }
116
  session.profile = profile;
117
+ invalidateCurrentPlan("Profile updated. Press Plan to refresh the build path.");
118
  saveSession();
119
  });
120
 
 
882
  if (idea) idea.goals = [...(session.goals || [])];
883
  }
884
 
885
+ function invalidateCurrentSeal(message) {
886
+ const idea = currentIdea();
887
+ if (idea?.score) idea.score = null;
888
+ clearCurrentArtifactFor(idea);
889
+ invalidateCurrentPlan("");
890
+ renderScore(null);
891
+ setVerdictDisplay("READY", 0, null);
892
+ renderWoodMap(null);
893
+ exportButton.disabled = true;
894
+ if (message) setSessionStatus(message);
895
+ }
896
+
897
+ function invalidateCurrentPlan(message) {
898
+ if (Array.isArray(session.last_plan)) delete session.last_plan;
899
+ renderPlan([]);
900
+ if (message) setSessionStatus(message);
901
+ }
902
+
903
+ function clearCurrentArtifactFor(idea) {
904
+ if (!idea || currentArtifact?.title === idea.title) currentArtifact = null;
905
+ if (!idea || session.last_artifact?.title === idea.title) delete session.last_artifact;
906
+ }
907
+
908
+ function setSessionStatus(message) {
909
+ session.ui_status = message;
910
+ corrections.textContent = message;
911
+ }
912
+
913
  async function exportNotes() {
914
  await exportMarkdown({
915
  endpoint: "/field_notes",