Skip to content

Commit

Permalink
fix(nami): [lw-11981] remove preloader for nami migration (#1599)
Browse files Browse the repository at this point in the history
  • Loading branch information
vetalcore authored and mirceahasegan committed Dec 17, 2024
1 parent adba716 commit 89b1544
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ const urlPath = walletRoutePaths.namiMigration;
export const NamiMigration = (): JSX.Element => {
const analytics = useAnalyticsContext();

useEffect(() => {
document.querySelector('#preloader')?.remove();
}, []);

useEffect(() => {
analytics.sendEventToPostHog(postHogNamiMigrationActions.onboarding.OPEN);
}, [analytics]);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable max-statements */
/* eslint-disable complexity */
/* eslint-disable no-magic-numbers */
import React, { useEffect, useState, ComponentType, useMemo } from 'react';
Expand Down Expand Up @@ -205,13 +206,18 @@ export const BrowserViewRoutes = ({ routesMap = defaultRoutes }: { routesMap?: R
[areExperimentsLoading, isLoadingWalletInfo, deletingWallet, cardanoWallet, stayOnAllDonePage]
);

const isInNamiMode = useMemo(
() => namiMigration?.mode === 'nami' && !isLoadingWalletInfo && cardanoWallet,
[cardanoWallet, isLoadingWalletInfo, namiMigration?.mode]
);

useEffect(() => {
if (isLoaded || isOnboarding) {
if (isLoaded || isOnboarding || isInNamiMode) {
document.querySelector('#preloader')?.remove();
}
}, [isLoaded, isOnboarding]);
}, [isLoaded, isOnboarding, isInNamiMode]);

if (namiMigration?.mode === 'nami' && !isLoadingWalletInfo && cardanoWallet) {
if (isInNamiMode) {
return (
<Lock
message={t('general.lock.namiMode.message')}
Expand Down

0 comments on commit 89b1544

Please sign in to comment.