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: keep failed timeline saves marked unsaved

[._.]/ Adam Eivy22d6098f0f62
diff --git a/client/src/pages/VideoTimelineEditor.jsx b/client/src/pages/VideoTimelineEditor.jsx
index b9f449d813..d6a6cae712 100644
--- a/client/src/pages/VideoTimelineEditor.jsx
+++ b/client/src/pages/VideoTimelineEditor.jsx
@@ -307,8 +307,9 @@ export default function VideoTimelineEditor() {
updatedAtRef.current = updated.updatedAt;
setProject((p) => ({ ...p, updatedAt: updated.updatedAt }));
return true;
- }).finally(() => {
- if (pendingLanesRef.current === next) pendingLanesRef.current = null;
+ }).then((saved) => {
+ if (saved && pendingLanesRef.current === next) pendingLanesRef.current = null;
+ return saved;
}), [projectId, refresh, queueWrite]);
// Debounced save: trim/fade edits fire many PATCHes per drag if we don't
diff --git a/client/src/pages/VideoTimelineEditor.test.jsx b/client/src/pages/VideoTimelineEditor.test.jsx
index 9a747a6ee2..06d4ff34a2 100644
--- a/client/src/pages/VideoTimelineEditor.test.jsx
+++ b/client/src/pages/VideoTimelineEditor.test.jsx
@@ -130,6 +130,20 @@ describe('pending lane saves', () => {
expect(savedUnload.defaultPrevented).toBe(false);
view.unmount();
});
+
+ it('keeps the leave warning after a save fails', async () => {
+ const view = render(<VideoTimelineEditor />);
+ await awaitPageLoaded('Loading timeline project');
+ api.updateTimelineProject.mockRejectedValueOnce(new Error('offline'));
+ fireEvent.click(screen.getByRole('button', { name: 'Add to timeline' }));
+
+ await waitFor(() => expect(api.updateTimelineProject).toHaveBeenCalledOnce(), { timeout: 1500 });
+ const failedSaveUnload = new Event('beforeunload', { cancelable: true });
+ window.dispatchEvent(failedSaveUnload);
+ expect(failedSaveUnload.defaultPrevented).toBe(true);
+ expect(toastError).toHaveBeenCalledWith('Save failed: offline');
+ view.unmount();
+ });
});
describe('lane visibility', () => {