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

Accounts.jsx component read accounts performance. #578

Open
hbulgarini opened this issue Aug 3, 2021 · 0 comments
Open

Accounts.jsx component read accounts performance. #578

hbulgarini opened this issue Aug 3, 2021 · 0 comments

Comments

@hbulgarini
Copy link

hbulgarini commented Aug 3, 2021

The way the useEffect for the src/components/Account/Account.jsx component is implemented is triggering the getAccount query multiple times ( not necessary on my opinion ) because it is defined to be executed every time the component gets updated ( no dependency set on the array parameter ). While the query is running and returning its corresponding state, the query is called again and again until it gets stopped.

If the purpose of the component is to work as a subscription listening to new events i would:

  1. Switch to useQuery and rely on polling parameter to determine a reading interval . ( There is no need for the useEffect since the process will be launched automatically every X time ).

  2. May be use a web socket instead of a query and subscribe accordingly so component gets updated when a new event happen WebSocket-Node

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

No branches or pull requests

1 participant