From c6ee25b9062020b6dda574cbe4801ec63ca09f8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Tue, 7 May 2024 12:29:16 +0200 Subject: [PATCH] feat(sync): Only sync when on edit mode The is done to save server resources, for accessed maps which aren't currently being edited. --- umap/static/umap/js/umap.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/umap/static/umap/js/umap.js b/umap/static/umap/js/umap.js index 1022521b..3d85ff3e 100644 --- a/umap/static/umap/js/umap.js +++ b/umap/static/umap/js/umap.js @@ -249,8 +249,6 @@ U.Map = L.Map.extend({ this.initContextMenu() this.on('click contextmenu.show', this.closeInplaceToolbar) this.sync = new U.SyncEngine(this) - - this.initSyncEngine() }, initSyncEngine: async function () { @@ -1602,6 +1600,7 @@ U.Map = L.Map.extend({ this.editEnabled = true this.drop.enable() this.fire('edit:enabled') + this.initSyncEngine() }, disableEdit: function () { @@ -1613,6 +1612,7 @@ U.Map = L.Map.extend({ this.fire('edit:disabled') this.editPanel.close() this.fullPanel.close() + this.sync.stop() }, hasEditMode: function () {