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

Enhance the contracts list by removing the duplicate requests, and reduce the time limit when loading the contracts by removing the onMounted lifecycle #2872

Conversation

Mahmoud-Emad
Copy link
Contributor

@Mahmoud-Emad Mahmoud-Emad commented Jun 4, 2024

Description

Enhance the contracts list by removing the duplicate requests, and reduce the time limit when loading the contracts by removing the onMounted lifecycle

Changes

  • Removed the 'onMount' from the 'onMounted' life cycle since it is not needed because we call the 'loadContracts' function on each change that happens on the table.
  • Fix the contracts table takes too much time to load.
  • Fix the undefined value of the total cost.

Related Issues

Screenshots/Video

Screenshot from 2024-06-04 18-52-10

Screencast.from.06-04-2024.06.46.01.PM.webm

Checklist

  • Tests included
  • Build pass
  • Documentation
  • Code format and docstrings
  • Screenshots/Video attached (needed for UI changes)

- Removed the 'onMount' from the 'onMounted' life cycle since it not needed because we call the 'loadContracts' function on each change happens on the table.
- Fix the contracts table takes too much time to load.
Copy link
Contributor

@amiraabouhadid amiraabouhadid left a comment

Choose a reason for hiding this comment

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

Good job, would be nice though if we can make only one request for the same node used by multiple contracts instead of for example requesting node 11 here twice
Screenshot from 2024-06-05 10-50-44

What do you think @AhmedHanafy725 ?

@0oM4R
Copy link
Contributor

0oM4R commented Jun 5, 2024

changing table options still takes so much time to load, is there anyway to enhance it ? like client side pagination, for example ?

@Mahmoud-Emad Mahmoud-Emad marked this pull request as draft June 6, 2024 05:55
- Replaced the static values with 'ref' concept to change the value when needed.
- Cached the nodes to use it when re-request to avoid the duplicated requests.
- Enhanced the list time by using the ''Promise.all and display what gets finished.
- Introduced a new hint alert to inform the user that the table will be reloaded in a bit.
- Replaced the 'update-options' event with the 'update-page' and 'update-size' events to avoid requesting on each change happens on the table and only request when changing the page/size.
- Created only one function to request to list the contracts based on it's type.
- Returned back the 'onMounted' life cycle and called the 'loadContracts' inside it.
- Remove the duplicate requests.
- Updated the 'getNodeInfo' function to request only the nodes that are not cached.
@Mahmoud-Emad Mahmoud-Emad marked this pull request as ready for review June 6, 2024 08:32
@maayarosama
Copy link
Contributor

Good job

@Mahmoud-Emad Mahmoud-Emad merged commit 9826c81 into development Jun 6, 2024
3 checks passed
@Mahmoud-Emad Mahmoud-Emad deleted the development_fix_double_requests_in_contracts_list_page branch June 6, 2024 14:50
0oM4R added a commit that referenced this pull request Jun 13, 2024
…tracts`

this is necessary now after changes in #2872
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.

6 participants