New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: content overwritten caused by diff merge on mobile platforms #9856
Conversation
(state/settings-open?) | ||
(state/close-settings!) | ||
|
||
(state/modal-opened?) | ||
(state/close-modal!) | ||
|
||
(state/get-left-sidebar-open?) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor fix for Android:
Settings should be closed before the left-sidebar.
@@ -1655,7 +1655,7 @@ | |||
(p/catch (fn [_] nil))) | |||
current-content (or current-content "") | |||
incoming-content (fs/read-file repo-dir incoming-file) | |||
merged-content (diff-merge/three-way-merge current-content current-content incoming-content format)] | |||
merged-content (diff-merge/three-way-merge "" incoming-content current-content format)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use empty content as the base.
@@ -103,7 +104,8 @@ | |||
(when (state/get-current-repo) | |||
(let [is-active? (.-isActive state)] | |||
(when-not is-active? | |||
(editor-handler/save-current-block!)) | |||
(editor-handler/save-current-block!) | |||
(repo-handler/persist-db!)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The primary fix is here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
19358f0
to
549a44b
Compare
Root Cause:
On mobile platforms, DB is not persisted if the app goes inactive or gets killed. So DB(datascript transit files) will lose sync with the disk files if the App is closed by system UI or launcher.
This is very different from the Desktop version, where transit files are saved when closing-app/switching-graph.