Skip to content
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

[Refactor] Improve state management #222

Open
wants to merge 151 commits into
base: master
Choose a base branch
from

Conversation

fpezzola
Copy link
Contributor

@fpezzola fpezzola commented Nov 17, 2022

Name of the feature/issue

Improve state management.

Description

This PR aims to improve the application performance by:

  • Split state subscription to avoid unnecessary re-renders
  • Virtualize transactions list
  • Encapsulate components to avoid unnecessary re-renders
  • Improve the way we build the activity list to avoid re-building it when it does not make sense.
  • Avoid updating state balances when there is no change.
  • Stop sending the lastActiveTime to the UI since it changes very often.
  • Stop saving transaction logs and prune the old transactions logs.

- remove lastActiveTime property
- remove block state subscription
@fpezzola fpezzola requested review from a team as code owners November 17, 2022 17:26
- Separate Gas Prices subscription from main state
- Separate  Activity list subscription from main state and improve its regenaration
- Separate exchange rates subscription from main state
@fpezzola fpezzola requested a review from a team as a code owner November 23, 2022 18:57
@fpezzola fpezzola changed the title [WIP][Refactor] Improve state management [Refactor] Improve state management Dec 21, 2022
Copy link
Contributor

@chk0912 chk0912 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great!

I will approve it after we fix the merging conflicts and I am able to try it.

packages/ui/src/util/balance.ts Outdated Show resolved Hide resolved
packages/ui/src/util/balance.ts Outdated Show resolved Hide resolved
@fpezzola
Copy link
Contributor Author

While I was trying to swap MATIC for USDT on uniswap, the gas unit was ETH for some seconds and then it was updated automatically to MATIC.
image

This still happens

image

After a few seconds is fixed

image

This is fixed now, can you re-check?

@fpezzola
Copy link
Contributor Author

image

Should be fixed by now, can you re-check?

MartnLecam and others added 13 commits April 26, 2023 11:53
* feat: Add logic to use hotkey hook which will allow to navigate the extension with hotkeys. It is implemented in header so no need to include it on each page

* feat: Update hotkey hook. Add util hotkeys with static values and getHotkeys function. Add more pages to hotkeys

* feat: Add hotkey to open extension. Add certain hotkeys which are for specific pages. Add icon and popup to display hotkeys for current page

* include popup with hotketys. upgrade package

* add change to have current tab value

* add validation to add new asset

* Prepare hotkeys to work in Mac. Fix New asset issue, only allow it on assets view in popuppage

* Fix focus on inputs issue. Fix onBack on networks page.

* Change way to get OS to avoid Promise. Remove hotkeys icon, just allow alt+h to see hotkeys. Added preventDefault. Fix typo in some descriptions

* Remove comment

* Logic to avoid showing hotkeys that are not allowed by permissions

* Add enable/disable hotkeys from preferences. Remove version number from settings and unstick logout button

* Allow enable/disable hotkeys from preferences - include it in preferencesController, removed from AppStatecontroller. Show generic hotkeys in preferences page. Add 2 components to show hotkeys. Change hotkeys popup to improve design

* Add new dialog with design only for hotkeys. Validate wherever it is needed if hotkeys are enabled. For all preferences pages we added the goback action.

* Finish design based on Flair.

* Remove unused state value

* Change permissions workaround to include all kind of settings

* Move all the hotkeys to one file. The others just read a component dictionary which has the hotkeys for them.

* Action list like settings, preferences, account menu have numeric shortcuts. Also removed connectHardwareWallet from hotkeys util as it was being opened twice, move it to components dictionary.

* Remove unused elements

* Changed hotkeys to keyboard shortcuts in modal. Add Rest account to Home screen

* Fix default value for hotkeys. Add ALT+O as hotkey in preferences page. Fix ALT+q definition. Add submit on enter for first use pages DefaultBrowser and welcome screens

---------

Co-authored-by: Julián Ariel Martínez <[email protected]>
[Feat] Improve provider down status + switch to backup option
* feat: send to smart contract warning

* feat: send to smart contract content edit
…ension into refactor/state-subscriptions-improvement
@MartnLecam MartnLecam self-assigned this Sep 27, 2023
@MartnLecam MartnLecam requested review from julianariel and a team as code owners October 17, 2023 16:32
@MartnLecam MartnLecam requested a review from a team as a code owner October 18, 2023 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants