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

fix: save the current universe before Markdown export (#5031)

[._.]/ Adam Eivy2882d9090ab5
diff --git a/client/src/components/universeBuilder/UniverseBuilderPage.jsx b/client/src/components/universeBuilder/UniverseBuilderPage.jsx
index 3a72685272..4e40df57bb 100644
--- a/client/src/components/universeBuilder/UniverseBuilderPage.jsx
+++ b/client/src/components/universeBuilder/UniverseBuilderPage.jsx
@@ -225,6 +225,11 @@ export default function UniverseBuilder() {
const handleExportMarkdown = useCallback(async () => {
if (!selectedId || exporting) return;
setExporting(true);
+ const flushed = await flushDraftIfDirty();
+ if (!flushed) {
+ setExporting(false);
+ return;
+ }
const markdown = await exportUniverseMarkdown(selectedId, { silent: true }).catch((error) => {
toast.error(error?.message || 'Failed to export universe');
return null;
@@ -234,7 +239,7 @@ export default function UniverseBuilder() {
const filename = `${downloadSlug(draft.name)}.md`;
downloadBlob(markdown, filename, 'text/markdown');
toast.success(`Downloaded ${filename}`);
- }, [draft.name, exporting, selectedId]);
+ }, [draft.name, exporting, flushDraftIfDirty, selectedId]);
// Page-level lightbox + gallery-metadata concern. A single MediaPreview at
// this level covers EVERY thumb on the page: variations, composite sheets,