Skip to content

Commit

Permalink
fix: During the route change, close account-export modal with minor u…
Browse files Browse the repository at this point in the history
…x/error handling
  • Loading branch information
hcho112 committed Mar 27, 2023
1 parent 4e56a08 commit d5be4db
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ export function WalletSelectorGetAWallet({
showModal,
setShowModal
}) {

const walletWrapperDiv = document.getElementById('near-wallet-selector-modal');
walletWrapperDiv?.classList.add('wallet-selector-get-a-wallet-modal');

if (showModal === 'more-near-wallets') {
const walletWrapperDiv = document.getElementById('near-wallet-selector-modal');
walletWrapperDiv?.classList.add('wallet-selector-get-a-wallet-modal');
}
useEffect(() => {

const initSelector = async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
import { useEffect } from 'react';
import { useLocation } from 'react-router-dom';

import { useExportAccountSelector } from './WalletSelectorExportContext';

export const WalletSelectorContent = () => {
const { ExportModal } = useExportAccountSelector();

const location = useLocation();
useEffect(() => {
//TODO: this is to mute css class injected from WalletSelectorGetAWallet component
const walletWrapperDiv = document.getElementById('near-wallet-selector-modal');
walletWrapperDiv?.classList.remove('wallet-selector-get-a-wallet-modal');
ExportModal?.show();
});
if (ExportModal) {
//TODO: this is to mute css class injected from WalletSelectorGetAWallet component
const walletWrapperDiv = document.getElementById('near-wallet-selector-modal');
walletWrapperDiv?.classList.remove('wallet-selector-get-a-wallet-modal');
ExportModal?.show();
}
}, [ExportModal]);

// On location change, close the modal
useEffect(() => {
ExportModal?.hide();
}, [location]);
return null;
};

0 comments on commit d5be4db

Please sign in to comment.