Repository navigation
[stable-0.1] fix(viewer): no overlapping saves, Ctrl+S everywhere, no fallback to the previous file - #460
Merged
AndyScherzinger merged 3 commits intoOct 27, 2026
Conversation
Autosave runs every 10 seconds next to the save button and Ctrl+S. When two saves overlapped, the second request still carried the old mtime and failed with "The file you are working on was updated in the meantime", although nobody else had touched the file. A save requested while one is running now waits for it and runs afterwards, so edits made in between are saved as well and a pending close still gets its answer. The map is marked unchanged when the request goes out and changed again when it fails, so edits made during a save are no longer lost. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de> (cherry picked from commit ea2776d) Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Inside the editor, Ctrl+S was handled in the bubble phase, where the editor's own key handlers could swallow it first. It is now handled in the capture phase and checks event.key instead of the deprecated event.which. With the focus outside the editor iframe, for example on the viewer's header, Ctrl+S opened the browser's save dialog. The viewer component now catches it while it is shown and asks the editor to save. Backport of 4b99f03 from main, where the viewer handler is a custom element; here the same handling lives in the Vue component. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
The viewer component looks the opened file up in the viewer's file list. When it is not there yet, setFile() got undefined and threw on file.filename, leaving the editor with the previously opened file: it then loaded that map, and autosave wrote to it, while the viewer showed the new file's name. setFile() now forgets the previous file in that case, so loading fails with "Could not load the file" and the viewer closes. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #459 for Nextcloud 32–35, plus one fix that only applies to this line. Based on the analysis of #259 (thanks @stephancordes for the diagnosis).
mountedand stops inbeforeDestroy(Vue 2.7, as the viewer app runs it) andbeforeUnmount(Vue 3, the test environment).setFile()threw onundefinedand left the previous file in place, so the editor loaded that map and autosave wrote to it while the viewer showed the new file's name.setFile()now forgets the previous file, so loading fails with "Could not load the file" and the viewer closes.Checked: unit tests (122 passing, 4 new), lint. Not yet tested on a live instance.
Note:
src/__tests__/MindMap.spec.jsandsrc/__tests__/mindmap.spec.jsdiffer only in case on this branch, so a checkout on Windows or macOS keeps only one of them. Main avoids that withmindmapElement.spec.js.🤖 AI (if applicable)