1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-24 19:10:22 +01:00

speedup transaction: save on advance gas modal should not close speed… (#14101)

This commit is contained in:
Jyoti Puri 2022-03-22 21:35:46 +05:30 committed by GitHub
parent a74f898dcc
commit 614457d9b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 7 deletions

View File

@ -11,7 +11,7 @@ import I18nValue from '../../../ui/i18n-value';
import { useAdvancedGasFeePopoverContext } from '../context'; import { useAdvancedGasFeePopoverContext } from '../context';
const AdvancedGasFeeSaveButton = () => { const AdvancedGasFeeSaveButton = () => {
const { closeAllModals } = useTransactionModalContext(); const { closeModal } = useTransactionModalContext();
const { updateTransactionEventFragment } = useTransactionEventFragment(); const { updateTransactionEventFragment } = useTransactionEventFragment();
const { updateTransaction } = useGasFeeContext(); const { updateTransaction } = useGasFeeContext();
const { const {
@ -33,7 +33,7 @@ const AdvancedGasFeeSaveButton = () => {
gas_edit_type: 'advanced', gas_edit_type: 'advanced',
}, },
}); });
closeAllModals(); closeModal(['advancedGasFee', 'editGasFee']);
}; };
return ( return (

View File

@ -84,7 +84,7 @@ const CancelSpeedupPopover = () => {
} else { } else {
speedUpTransaction(); speedUpTransaction();
} }
closeModal('cancelSpeedUpTransaction'); closeModal(['cancelSpeedUpTransaction']);
}; };
return ( return (

View File

@ -87,7 +87,7 @@ const EditGasItem = ({ priorityLevel }) => {
}, },
}); });
closeModal('editGasFee'); closeModal(['editGasFee']);
if (priorityLevel === PRIORITY_LEVELS.TEN_PERCENT_INCREASED) { if (priorityLevel === PRIORITY_LEVELS.TEN_PERCENT_INCREASED) {
updateTransactionToTenPercentIncreasedGasFee(); updateTransactionToTenPercentIncreasedGasFee();

View File

@ -6,13 +6,15 @@ export const TransactionModalContext = createContext({});
export const TransactionModalContextProvider = ({ children }) => { export const TransactionModalContextProvider = ({ children }) => {
const [openModals, setOpenModals] = useState([]); const [openModals, setOpenModals] = useState([]);
const closeModal = (modalName) => { const closeModal = (modalNames) => {
const index = openModals.indexOf(modalName);
if (openModals < 0) { if (openModals < 0) {
return; return;
} }
const modals = [...openModals]; const modals = [...openModals];
modals.splice(index, 1); modalNames.forEach((modal) => {
const index = openModals.indexOf(modal);
modals.splice(index, 1);
});
setOpenModals(modals); setOpenModals(modals);
}; };