Skip to content

Commit

Permalink
πŸ› Fix share link backward compatibility with cached bundle.js
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
luontola committed Jul 31, 2023
1 parent 326b37c commit b59719e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion web/js/pages/TerritoryPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit b59719e

Please sign in to comment.