fix: [M3-7881] - Restore loading state to Users & Grants table #10303
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 returntrue
. 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 🔄
isLoading
withisInitialLoading
in the query to fetch users as per documentation [1, 2]Target release date 🗓️
4/1/24
Preview 📷
RestrictedPerpetualLoadingState.mov
CurrentBug.mov
UnrestrictedAccountLoadingState.mov
RestrictedNoLoadingState.mov
How to test 🧪
Prerequisites
(How to setup test environment)
Reproduction steps
(How to reproduce the issue, if applicable)
Verification steps
/profile
network request for this or log into the child account and confirm).)/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