From 462bc96f3d43f6d1367270117b8974049e2c8613 Mon Sep 17 00:00:00 2001 From: MicLieg <38057464+MicLieg@users.noreply.github.com> Date: Wed, 10 Jul 2024 17:01:32 +0200 Subject: [PATCH] updateMap will be automatically triggered on page reload (#570) * feat: a page reload will automatically trigger updateMap This commit adds a mounted lifecycle hook to the MainMenu component in order to update the map when the page is reloaded or refreshed. * fix: prevent reusing of the tileCacheHash instead of using updateMap --- BlueMapCommon/webapp/src/js/BlueMapApp.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/BlueMapCommon/webapp/src/js/BlueMapApp.js b/BlueMapCommon/webapp/src/js/BlueMapApp.js index 27b70744..9cde275c 100644 --- a/BlueMapCommon/webapp/src/js/BlueMapApp.js +++ b/BlueMapCommon/webapp/src/js/BlueMapApp.js @@ -598,7 +598,12 @@ export class BlueMapApp { return; } - this.mapViewer.clearTileCache(this.loadUserSetting("tileCacheHash", this.mapViewer.tileCacheHash)); + // Only reuse the user's tile cash hash if the current browser navigation event is not a reload. + // If it's a reload, we assume the user is troubleshooting and actually wants to refresh the map. + const [entry] = performance.getEntriesByType("navigation"); + if (entry.type != "reload") { + this.mapViewer.clearTileCache(this.loadUserSetting("tileCacheHash", this.mapViewer.tileCacheHash)); + } this.mapViewer.superSampling = this.loadUserSetting("superSampling", this.mapViewer.data.superSampling); this.mapViewer.data.loadedHiresViewDistance = this.loadUserSetting("hiresViewDistance", this.mapViewer.data.loadedHiresViewDistance);