From 179720a7f2c790ea5557bb5caabe22a926b3e106 Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Mon, 7 Feb 2022 15:19:47 +0100 Subject: Editor : on import, preserve the newest notes --- editor/editor.ml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'editor/editor.ml') 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 -- cgit v1.2.3