mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 18:00:18 +01:00
[FLASK] Fix a crash that occurred after a snap confirmation had been approved (#16864)
* Fix a crash that occurred after a snap confirmation had been approved * Fix lint * Move code below early return
This commit is contained in:
parent
7a1f75d17f
commit
5cca4b9b44
@ -176,9 +176,12 @@ export default function ConfirmationPage({
|
||||
};
|
||||
|
||||
///: BEGIN:ONLY_INCLUDE_IN(flask)
|
||||
const {
|
||||
manifest: { proposedName },
|
||||
} = useSelector((state) => getSnap(state, pendingConfirmation?.origin));
|
||||
const snap = useSelector((state) =>
|
||||
getSnap(state, pendingConfirmation?.origin),
|
||||
);
|
||||
|
||||
// When pendingConfirmation is undefined, this will also be undefined
|
||||
const proposedName = snap?.manifest.proposedName;
|
||||
|
||||
const SNAP_DIALOG_TYPE = [
|
||||
MESSAGE_TYPE.SNAP_DIALOG_ALERT,
|
||||
@ -224,19 +227,6 @@ export default function ConfirmationPage({
|
||||
///: END:ONLY_INCLUDE_IN
|
||||
]);
|
||||
|
||||
const hasInputState = (type) => {
|
||||
return INPUT_STATE_CONFIRMATIONS.includes(type);
|
||||
};
|
||||
|
||||
const handleSubmit = () =>
|
||||
templateState[pendingConfirmation.id]?.useWarningModal
|
||||
? setShowWarningModal(true)
|
||||
: templatedValues.onSubmit(
|
||||
hasInputState(pendingConfirmation.type)
|
||||
? inputStates[MESSAGE_TYPE.SNAP_DIALOG_PROMPT]
|
||||
: null,
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
// If the number of pending confirmations reduces to zero when the user
|
||||
// return them to the default route. Otherwise, if the number of pending
|
||||
@ -256,10 +246,24 @@ export default function ConfirmationPage({
|
||||
currentPendingConfirmation,
|
||||
redirectToHomeOnZeroConfirmations,
|
||||
]);
|
||||
|
||||
if (!pendingConfirmation) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const hasInputState = (type) => {
|
||||
return INPUT_STATE_CONFIRMATIONS.includes(type);
|
||||
};
|
||||
|
||||
const handleSubmit = () =>
|
||||
templateState[pendingConfirmation.id]?.useWarningModal
|
||||
? setShowWarningModal(true)
|
||||
: templatedValues.onSubmit(
|
||||
hasInputState(pendingConfirmation.type)
|
||||
? inputStates[MESSAGE_TYPE.SNAP_DIALOG_PROMPT]
|
||||
: null,
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="confirmation-page">
|
||||
{pendingConfirmations.length > 1 && (
|
||||
|
Loading…
Reference in New Issue
Block a user