From f964bfff0fee383eb2cd421f2f39c92995a06e9c 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 1584e6a4..41cdbaa9 100644 --- a/umap/static/umap/js/umap.js +++ b/umap/static/umap/js/umap.js @@ -245,8 +245,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 () { @@ -1599,6 +1597,7 @@ U.Map = L.Map.extend({ this.editEnabled = true this.drop.enable() this.fire('edit:enabled') + this.initSyncEngine() }, disableEdit: function () { @@ -1610,6 +1609,7 @@ U.Map = L.Map.extend({ this.fire('edit:disabled') this.editPanel.close() this.fullPanel.close() + this.sync.stop() }, hasEditMode: function () {