From ae79daec7e38af106ab6432db7ffe3237c484128 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Mon, 21 Oct 2024 15:40:37 +0200 Subject: [PATCH 1/2] fix: always call propagate at end of save Otherwise the renderEditToolbar will reset name and all. fix #2225 --- umap/static/umap/js/umap.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/umap/static/umap/js/umap.js b/umap/static/umap/js/umap.js index bb399b07..04971faf 100644 --- a/umap/static/umap/js/umap.js +++ b/umap/static/umap/js/umap.js @@ -1049,7 +1049,6 @@ U.Map = L.Map.extend({ return } this.options.user = data.user - this.renderEditToolbar() if (!this.options.umap_id) { this.options.umap_id = data.id this.permissions.setOptions(data.permissions) @@ -1087,7 +1086,6 @@ U.Map = L.Map.extend({ } else { window.location = data.url } - this.propagate() return true }, @@ -1107,6 +1105,7 @@ U.Map = L.Map.extend({ } this.isDirty = false this.renderEditToolbar() + this.propagate() this.fire('saved') }, From a2af7171d97c45f2466c18b60b7c21b8147880b9 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Mon, 21 Oct 2024 16:25:07 +0200 Subject: [PATCH 2/2] chore: call render at end of save All changes at some point should call render, and render should become more subtle to update only the needed part according to the actual changes --- umap/static/umap/js/umap.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/umap/static/umap/js/umap.js b/umap/static/umap/js/umap.js index 04971faf..7c65436f 100644 --- a/umap/static/umap/js/umap.js +++ b/umap/static/umap/js/umap.js @@ -1104,8 +1104,10 @@ U.Map = L.Map.extend({ if (datalayer.isDirty) await datalayer.save() } this.isDirty = false - this.renderEditToolbar() - this.propagate() + // Do a blind render for now, as we are not sure what could + // have changed, we'll be more subtil when we'll remove the + // save action + this.render(['name', 'user', 'permissions']) this.fire('saved') },