Skip to content

Commit

Permalink
fix: performance + approval page submit button entering on loading st…
Browse files Browse the repository at this point in the history
…ate (#1778)

- Closes #1770 
- Closes FE-1300

This PR also removes intentional delays that we had for a more smooth
loading process
  • Loading branch information
LuizAsFight authored Jan 19, 2025
1 parent d405b4c commit 6ddb001
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .changeset/dry-days-flow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"fuels-wallet": patch
---

fix: review button entering on loading state after getting ready to approve
5 changes: 5 additions & 0 deletions .changeset/lemon-doors-protect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"fuels-wallet": patch
---

feat: remove intentional longer loading states to avoid blinking.
Original file line number Diff line number Diff line change
Expand Up @@ -414,11 +414,6 @@ export const transactionRequestMachine = createMachine(
throw new Error('Invalid simulateTransaction input');
}

// Enforce a minimum delay to show the loading state
// this creates a better experience for the user as the
// screen doesn't flash between states
await delay(600);

const simulatedInfo = await TxService.simulateTransaction(input);
return simulatedInfo;
},
Expand Down
3 changes: 0 additions & 3 deletions packages/app/src/systems/Network/machines/chainInfoMachine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,6 @@ export const chainInfoMachine = createMachine(
throw new Error('No chain URL');
}

// Enforce a minimum delay to show the loading state
await delay(600);

return NetworkService.getChainInfo(input);
},
}),
Expand Down
16 changes: 15 additions & 1 deletion packages/app/src/systems/Send/machines/sendMachine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export const sendMachine = createMachine(
},
{
actions: ['assignTransactionData'],
target: 'readyToSend',
target: 'waitingToAllowSending',
},
],
},
Expand All @@ -149,6 +149,20 @@ export const sendMachine = createMachine(
},
},
},
// @TODO: "waitingToAllowSending" only exists to allow the useEffect on useSend to trigger, avoiding an error where the review button was enabled and then in loading state right after
waitingToAllowSending: {
on: {
SET_INPUT: {
actions: ['assignInput'],
target: 'changingInput',
},
},
after: {
500: {
target: 'readyToSend',
},
},
},
readyToSend: {
on: {
CONFIRM: { actions: ['callTransactionRequest'] },
Expand Down

0 comments on commit 6ddb001

Please sign in to comment.