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: [M3-7881] - Restore loading state to Users & Grants table #10303

Merged
merged 3 commits into from
Mar 22, 2024

Conversation

mjac0bs
Copy link
Contributor

@mjac0bs mjac0bs commented Mar 20, 2024

Description πŸ“

Recently, we lost loading state on the Users table on the Users & Grants page. In the UI, this means we'd go directly from the empty state table ("No items to display.") to the full list of users, once the request returned the data.

We attempted to throw in a bug fix for perpetually loading table state for a restricted user in #10233, and inadvertently broke the loading state for other users. This PR has the real fix for the original issue we were seeing, which stems from a breaking change in TanStack Query v4. TLDR: when a query is disabled, isLoading will perpetually return true. Since we disable the useAccountUsers query for a restricted user, that would be the case here (and therefore we got stuck in loading table state.)

Changes πŸ”„

  • Replace isLoading with isInitialLoading in the query to fetch users as per documentation [1, 2]

Target release date πŸ—“οΈ

4/1/24

Preview πŸ“·

Before - Initial Issue Before - Attempted Fix (Current Issue) After - Unrestricted Users After - Restricted Users
RestrictedPerpetualLoadingState.mov
CurrentBug.mov
UnrestrictedAccountLoadingState.mov
RestrictedNoLoadingState.mov

How to test πŸ§ͺ

Prerequisites

(How to setup test environment)

  • Know where the team Parent/Child account login credentials are.

Reproduction steps

(How to reproduce the issue, if applicable)

Verification steps

  • On this branch, log in as unrestricted user and go to http://localhost:3000/account/users.
  • Confirm that there is loading state for the table.
  • Log into a parent account and switch to a proxy account. (Confirm that it is a restricted proxy account (you can check the proxy's /profile network request for this or log into the child account and confirm).)
  • Since a restricted user does not have access to the /account/users endpoint, go to http://localhost:3000/account/users and confirm that empty state tables are displayed. Tables should not get stuck in loading state.

As an Author I have considered πŸ€”

Check all that apply

  • πŸ‘€ Doing a self review
  • ❔ Our contribution guidelines
  • 🀏 Splitting feature into small PRs
  • βž• Adding a changeset
  • πŸ§ͺ Providing/Improving test coverage
  • πŸ” Removing all sensitive information from the code and PR description
  • 🚩 Using a feature flag to protect the release
  • πŸ‘£ Providing comprehensive reproduction steps
  • πŸ“‘ Providing or updating our documentation
  • πŸ•› Scheduling a pair reviewing session
  • πŸ“± Providing mobile support
  • β™Ώ Providing accessibility support

@mjac0bs mjac0bs requested a review from a team as a code owner March 20, 2024 23:19
@mjac0bs mjac0bs requested review from jdamore-linode and carrillo-erik and removed request for a team March 20, 2024 23:19
@mjac0bs mjac0bs self-assigned this Mar 20, 2024
Copy link

github-actions bot commented Mar 20, 2024

Coverage Report: βœ…
Base Coverage: 81.5%
Current Coverage: 81.5%

Copy link
Contributor

@bnussman-akamai bnussman-akamai left a comment

Choose a reason for hiding this comment

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

Awesome! Good catch on how the TanStack Query change affected this!

@mjac0bs mjac0bs added Add'tl Approval Needed Waiting on another approval! Bug Fixes for regressions or bugs Parent / Child Account labels Mar 21, 2024
Copy link
Contributor

@jaalah-akamai jaalah-akamai left a comment

Choose a reason for hiding this comment

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

Good fix

@jaalah-akamai jaalah-akamai added Approved Multiple approvals and ready to merge! and removed Add'tl Approval Needed Waiting on another approval! labels Mar 22, 2024
@mjac0bs mjac0bs merged commit a6da30b into linode:develop Mar 22, 2024
18 checks passed
@mjac0bs mjac0bs added the React Query Relating to the transition to use React Query label Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Approved Multiple approvals and ready to merge! Bug Fixes for regressions or bugs Parent / Child Account React Query Relating to the transition to use React Query
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants