From b59719ec4e1247cfae5059d0d8749da06b2ae950 Mon Sep 17 00:00:00 2001 From: Esko Luontola Date: Mon, 31 Jul 2023 03:05:45 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20share=20link=20backward=20?= =?UTF-8?q?compatibility=20with=20cached=20bundle.js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Why: - If somebody has a cached version of the site's JavaScript from before the latest release, which didn't have cache-control headers that would force timely revalidation, then opening a new shared link would produce a page not found error. We can remove the "#" only after the old site is no longer in any browser's cache. --- web/js/pages/TerritoryPage.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/web/js/pages/TerritoryPage.tsx b/web/js/pages/TerritoryPage.tsx index 40901f1e..c101be19 100644 --- a/web/js/pages/TerritoryPage.tsx +++ b/web/js/pages/TerritoryPage.tsx @@ -22,7 +22,8 @@ const ShareButton = ({congregationId, territoryId, territoryNumber}) => { const togglePopup = async () => { if (!shareUrl) { const url = await shareTerritory(congregationId, territoryId); - setShareUrl(url + '/' + encodeURIComponent(territoryNumber).replaceAll(/%../g, "_")); + // TODO: change "#/" to a "/" after nobody has a cached page older than 2023-07-31, to avoid incompatibility with the old router + setShareUrl(url + '#/' + encodeURIComponent(territoryNumber).replaceAll(/%../g, "_")); } setOpen(!open); }