summaryrefslogtreecommitdiff
path: root/editor/editor.ml
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@dailly.me>2022-02-07 15:19:47 +0100
committerSébastien Dailly <sebastien@dailly.me>2022-02-07 16:43:33 +0100
commit179720a7f2c790ea5557bb5caabe22a926b3e106 (patch)
treeeb3824ce5c82ea16d6499844ab0cb44df150ac26 /editor/editor.ml
parentf6a1a4f2f44e0af679467620f89d0732021cf934 (diff)
Editor : on import, preserve the newest notes
Diffstat (limited to 'editor/editor.ml')
-rwxr-xr-xeditor/editor.ml11
1 files changed, 9 insertions, 2 deletions
diff --git a/editor/editor.ml b/editor/editor.ml
index c80b426..51ff3e4 100755
--- a/editor/editor.ml
+++ b/editor/editor.ml
@@ -77,8 +77,15 @@ module Store = struct
let save = State.Storage.save
content_obj
state.page_id
- ~check:(fun previous_state ->
- Js.Opt.case previous_state##.date
+ (* There three date here :
+ - The actual date at the time we save the note
+ - The date associated with the note when we loaded it first time
+ - The date associated with the note at the time we want to update it
+
+ The two last may differ if the note has been updated in another one tab. *)
+ ~check:(fun ~previous ~update ->
+ let _ = update in
+ Js.Opt.case previous##.date
(fun () -> true)
(fun date ->
(* I do not figure how the previous date could be older