Skip to content
This repository was archived by the owner on Apr 19, 2024. It is now read-only.

Commit 247ac88

Browse files
committed
fix error with local storage that does not update when value is changing
1 parent b3bc727 commit 247ac88

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/domains/dashboard/components/migration-manager/migration-manager.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import { selectSignInUrl } from "domains/global/selectors"
1414
import { useRequestRefreshOfAccessMessage } from "hooks/use-user-node-access"
1515
import { selectIsCloudEnabled } from "domains/global/selectors"
1616
import { selectRegistry } from "domains/global/selectors"
17-
import { utmParametersToString } from "domains/global/selectors"
1817

1918
// const PROMO_SIGN_UP_CLOUD: PromoProps = { userStatus: "UNKNOWN", nodeClaimedStatus: "NOT_CLAIMED" } //CLOUD
2019
// const PROMO_SIGN_IN_CLOUD: PromoProps = {
@@ -78,7 +77,13 @@ const MigrationManager = () => {
7877

7978
const prefrenceID = migrationModalPromoInfo?.tickBoxOption.prefrenceID || ""
8079

81-
const [hasPromoSelectionSaved, savePromoRemindMeSelection] = useLocalStorage(prefrenceID)
80+
/**
81+
* There is seem to be a bug when we are using the useLocalStorage,
82+
* the value to be returned does not change when prefrenceID is changing.
83+
* For that reason we acces the localStorage directly
84+
*/
85+
const [, savePromoRemindMeSelection] = useLocalStorage(prefrenceID)
86+
const hasPromoSelectionSaved = localStorage.getItem(prefrenceID)
8287

8388
const closeModal = () => {
8489
setModalOpen(false)

0 commit comments

Comments
 (0)