From b9f0f99dd97ff4b39b22a573d74e4f827e296fd5 Mon Sep 17 00:00:00 2001 From: Nguyen Viet <36178659+nqviet@users.noreply.github.com> Date: Thu, 18 Nov 2021 19:37:16 +0700 Subject: [PATCH 1/3] issue https://github.com/topcoder-platform/micro-frontends-challenges-app/issues/143 (#73) --- src/actions/gigs/effectors.js | 11 +++++++++-- src/containers/Gigs/index.jsx | 7 ++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/actions/gigs/effectors.js b/src/actions/gigs/effectors.js index 6be90af..edcb9f1 100644 --- a/src/actions/gigs/effectors.js +++ b/src/actions/gigs/effectors.js @@ -137,11 +137,18 @@ export const loadSkills = async ({ dispatch, getState }) => { * URL query by replacing URL in history. * * @param {Object} store redux store object + * @param {Object} options.mountLocation location object */ -export const updateStateAndQuery = ({ dispatch, getState }) => { +export const updateStateAndQuery = ({ dispatch, getState }, options) => { + const location = options ? options.mountLocation : window.location; + const isGigsLocation = location.pathname === window.location.pathname; + dispatch(actions.updateStateFromQuery(location.search)); const query = makeQueryFromState(selectors.getStateSlice(getState())); - window.history.replaceState(null, "", `${location.pathname}?${query}`); + + if (isGigsLocation) { + window.history.replaceState(null, "", `${location.pathname}?${query}`); + } }; /** diff --git a/src/containers/Gigs/index.jsx b/src/containers/Gigs/index.jsx index 2b43b39..73123fe 100644 --- a/src/containers/Gigs/index.jsx +++ b/src/containers/Gigs/index.jsx @@ -18,13 +18,18 @@ import { setReferralCookie } from "utils/referral"; * normalizes query. Then depending on if state has changed loads gigs page. */ const onMount = async () => { + const mountLocation = { + search: window.location.search, + pathname: window.location.pathname, + }; setReferralCookie(); const hasInitialData = selectors.getHasInitialData(store.getState()); if (!hasInitialData) { await effectors.loadInitialData(store); } const stateOld = store.getState(); - effectors.updateStateAndQuery(store); + const options = { mountLocation }; + effectors.updateStateAndQuery(store, options); if (stateOld === store.getState() && !hasInitialData) { // If after updating state from query the state stays the same we need to // manually load gigs. In other case gigs will be loaded by useUpdateEffect From 7a84786e5c6dc8b96e70316c791352a66d8af5d7 Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Thu, 18 Nov 2021 20:39:45 +0800 Subject: [PATCH 2/3] ci: deploy --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index ce41cbd..486107a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -77,6 +77,7 @@ workflows: branches: only: - dev + - challenges-bug-bash # Production builds are exectuted only on tagged commits to the # master branch. From a3b86d71da6b57cb16e9336254d28bc097575d4e Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Sun, 28 Nov 2021 00:22:08 +0800 Subject: [PATCH 3/3] reset ci --- .circleci/config.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 486107a..ce41cbd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -77,7 +77,6 @@ workflows: branches: only: - dev - - challenges-bug-bash # Production builds are exectuted only on tagged commits to the # master branch.