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

fix infinite loop of setting state then useEffect in ItemViewer #87

Merged
merged 3 commits into from Apr 4, 2022

Conversation

nbarlowATI
Copy link
Member

Slightly hacky (but very minimal) fix: to avoid calling setItems inside useEffect (which leads to an infinite loop, as setting the state triggers a re-render, which calls useEffect) - just check if the item has changed.
Closes #69

@nbarlowATI nbarlowATI requested a review from mhauru April 4, 2022 11:01
@coveralls
Copy link

Pull Request Test Coverage Report for Build 2089405586

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.1%) to 90.674%

Totals Coverage Status
Change from base Build 2089390822: 0.1%
Covered Lines: 982
Relevant Lines: 1083

💛 - Coveralls

@coveralls
Copy link

coveralls commented Apr 4, 2022

Pull Request Test Coverage Report for Build 2089731232

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.1%) to 90.674%

Totals Coverage Status
Change from base Build 2089390822: 0.1%
Covered Lines: 982
Relevant Lines: 1083

💛 - Coveralls

Copy link
Collaborator

@mhauru mhauru left a comment

Choose a reason for hiding this comment

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

Nice!

@mhauru mhauru merged commit 113f28b into main Apr 4, 2022
@AoifeHughes AoifeHughes deleted the bugfix/69-itemview-reload-loop branch November 6, 2023 13:27
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.

"ItemViewer" component is continually making GET requests to backend when active
3 participants