Skip to content

Commit

Permalink
fixed the browserhistory for the modal in ballot page
Browse files Browse the repository at this point in the history
  • Loading branch information
anup2307 committed Jan 3, 2024
1 parent 247a12b commit 9268cf5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/js/common/utils/historyPush.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/js/components/Share/ShareButtonDesktopTablet.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit 9268cf5

Please sign in to comment.