diff --git a/src/js/common/utils/historyPush.js b/src/js/common/utils/historyPush.js index 96daf3c47..0461c4de2 100644 --- a/src/js/common/utils/historyPush.js +++ b/src/js/common/utils/historyPush.js @@ -4,8 +4,9 @@ import webAppConfig from '../../config'; // See v5: https://reactrouter.com/native/api/Hooks/usehistory // IMPORTANT: The HTML5 window.history, is very different from the react-router V5 history, don't use window.history! // removePriorPathname determines whether the route should be pushed or replace the previous entry in the history stack. -export default function historyPush (route, removePriorPathname = false) { - if (route !== global.weVoteGlobalHistory.location.pathname) { +// doNotPushHistory tells whether the history needs to be updated or not. +export default function historyPush (route, removePriorPathname = false, doNotPushToHistory = false) { + if (route !== global.weVoteGlobalHistory.location.pathname && !doNotPushToHistory) { if (removePriorPathname) { global.weVoteGlobalHistory.replace(route); } else { diff --git a/src/js/components/Share/ShareButtonDesktopTablet.jsx b/src/js/components/Share/ShareButtonDesktopTablet.jsx index 97efa45ee..4307d01bb 100644 --- a/src/js/components/Share/ShareButtonDesktopTablet.jsx +++ b/src/js/components/Share/ShareButtonDesktopTablet.jsx @@ -113,7 +113,7 @@ class ShareButtonDesktopTablet extends Component { if (!stringContains('/modal/share', pathname) && isWebApp()) { const pathnameWithModalShare = `${pathname}${pathname.endsWith('/') ? '' : '/'}modal/share`; // console.log('Navigation ShareButtonDesktopTablet openShareModal ', pathnameWithModalShare) - historyPush(pathnameWithModalShare); + historyPush(pathnameWithModalShare, false, true); } }