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 bug when fetching user metrics for dashboard header (fixes #2409) #2411

Merged
merged 1 commit into from
Sep 3, 2024

Conversation

jake-low
Copy link
Contributor

There were a couple of bugs in WithUserMetrics.componentDidUpdate that prevented it from running when it was supposed to. When the component mounts, props.user is null. Once the user loads, componentDidUpdate is supposed to fetch leaderboard metrics, but since it first checks if prevProps["user"]?.score is truthy, it was doing nothing. This only triggered during full page load; when navigating from another route componentDidMount would run with a non-null user and correctly fetch the metrics. The problem condition wasn't necessary during either mount or update, so I removed it. I also made the update methods async, removed unused arguments, and fixed a bug where { loading: true } would be set if the user had opted out of leaderboards (resulting I think in a spinner being shown forever, though I didn't test to verify this).

@jake-low jake-low force-pushed the jlow/fix-dashboard-user-metrics branch from 9b9430f to 3cb2db0 Compare August 14, 2024 20:56
Copy link

codecov bot commented Aug 14, 2024

Codecov Report

Attention: Patch coverage is 0% with 24 lines in your changes missing coverage. Please review.

Project coverage is 23.38%. Comparing base (95dca9d) to head (3cb2db0).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
...components/HOCs/WithUserMetrics/WithUserMetrics.js 0.00% 20 Missing and 4 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2411   +/-   ##
=======================================
  Coverage   23.38%   23.38%           
=======================================
  Files         649      649           
  Lines       22514    22510    -4     
  Branches     6902     6900    -2     
=======================================
  Hits         5264     5264           
+ Misses      14425    14423    -2     
+ Partials     2825     2823    -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jake-low jake-low marked this pull request as ready for review August 14, 2024 21:15
@CollinBeczak
Copy link
Collaborator

LGTM, I made a separate pr #2428 that fixes a second bug with the CircularProgress loader state.

@jake-low jake-low merged commit 1ab0ba9 into main Sep 3, 2024
5 of 6 checks passed
@jake-low jake-low deleted the jlow/fix-dashboard-user-metrics branch September 3, 2024 17:03
@CollinBeczak CollinBeczak mentioned this pull request Sep 9, 2024
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.

2 participants