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

refactor([story-builder-import-partial-commit]): centralize arcAlreadyPersisted reset in a preview effect

[._.]/ Adam Eivyb5d5a38b4c5e
diff --git a/client/src/pages/StoryBuilder.jsx b/client/src/pages/StoryBuilder.jsx
index 0620fa91ea..1918a88350 100644
--- a/client/src/pages/StoryBuilder.jsx
+++ b/client/src/pages/StoryBuilder.jsx
@@ -195,6 +195,9 @@ function ImportPanel({ onCreated }) {
// re-creates the issues — re-sending the full payload would clobber the
// persisted state and risk duplicate issues. Mirrors Importer.jsx.
const [arcAlreadyPersisted, setArcAlreadyPersisted] = useState(false);
+ // Any path that clears the preview (analyze, Re-analyze) is a fresh attempt,
+ // so the partial-retry state can't survive it — centralize the reset here.
+ useEffect(() => { if (!preview) setArcAlreadyPersisted(false); }, [preview]);
const types = IMPORTER_CONTENT_TYPES || ['short-story', 'novel', 'screenplay', 'comic-script'];
@@ -211,7 +214,7 @@ function ImportPanel({ onCreated }) {
{ silent: true },
).catch((err) => { toast.error(err?.message || 'Analyze failed'); return null; });
setAnalyzing(false);
- if (res) { setPreview(res); setArcAlreadyPersisted(false); }
+ if (res) setPreview(res);
};
const retryIssues = async () => {
@@ -350,7 +353,7 @@ function ImportPanel({ onCreated }) {
{committing ? <Loader2 className="w-4 h-4 animate-spin" /> : <Check className="w-4 h-4" />}
{arcAlreadyPersisted ? 'Retry issues & start building' : 'Import & start building'}
</button>
- <button onClick={() => { setPreview(null); setArcAlreadyPersisted(false); }} disabled={committing}
+ <button onClick={() => setPreview(null)} disabled={committing}
className="text-sm text-gray-400 hover:text-white px-2">Re-analyze</button>
</div>
</div>