-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: POL gas fee is reused after switching to a new network #30417
base: main
Are you sure you want to change the base?
Conversation
aeb2774
to
a795786
Compare
Builds ready [a795786]
Page Load Metrics (1447 ± 44 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Screen.Recording.2025-02-20.at.12.36.38.mov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add some unit tests?
const isSwapsChain = useSelector(getIsSwapsChain); | ||
|
||
useGasFeeEstimates(network?.id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that you need to initialise polling here again.. The send duck already instructs the gasFeeController to start polling. And that send duck initialisation is triggered whenever we reach a edit send page (startDraftTransaction, editExistingTransaction)
// remove this logic once getGasFeeEstimates is typed | ||
const gasFee1559 = maybeGasFee ?? medium?.suggestedMaxFeePerGas; | ||
// Need to use estimates from gas fee controller instead of transaction gas estimates bc transaction gasEstimates don't get cleared after submitting a POL tx | ||
const { medium } = useSelector(getGasFeeControllerEstimates); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only change that you need. If the confirmTransaction
state exists, the getGasFeeEstimates
takes the maxFeePerGas
and maxPriorityFeePerGas
from it. Otherwise it gets those values from the gas fee controller state directly.
This should be a temporary fix, because I believe that the main issue is that we are not clearing the confirmation redux state after successfully submitting the confirmation successfully (store.confirmTransaction
). FYI @matthewwalsh0
This PR is not necessary anymore. Fix is implemented here |
Description
Related issues
Fixes: #29374
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist