Skip to content

Commit

Permalink
[Response Ops][Cases] Spinner on assigning user to case from case page (
Browse files Browse the repository at this point in the history
#191490)

## Summary

Fixes #190303

In 8.15 we disabled a request that showed a spinner while React Query's
`isLoading` was true. `isLoading` remains true as long as no data has
been received. Because the request was disabled, `isLoading` stayed true
the entire time, causing the spinner to be displayed instead of the form
that would have activated the request. The fix uses another React Query
state called `isFetching`, which is only true while the request is
actively being made, so initially, no spinner is shown.

## Release Note
Fix endless loading spinner when wanting to add a assignee to a case
from the cases list
  • Loading branch information
jcger authored Aug 29, 2024
1 parent 52cbd49 commit 19f6469
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -460,4 +460,18 @@ describe('EditAssigneesSelectable', () => {
],
});
});

it('renders even with no assignee set yet', async () => {
const selectedCases = [{ ...basicCase, assignees: [] }];
const result = appMock.render(
<EditAssigneesSelectable {...props} selectedCases={selectedCases} />
);

await waitFor(() => {
expect(result.getByTestId('cases-actions-assignees-edit-selectable')).toBeInTheDocument();
});

expect(result.getByPlaceholderText('Find a user')).toBeInTheDocument();
expect(result.getByText('Selected: 0')).toBeInTheDocument();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const EditAssigneesSelectableComponent: React.FC<Props> = ({
[selectedCases]
);

const { data, isLoading: isLoadingUserProfiles } = useBulkGetUserProfiles({
const { data, isFetching: isLoadingUserProfiles } = useBulkGetUserProfiles({
uids: Array.from(assignees.values()),
});

Expand Down

0 comments on commit 19f6469

Please sign in to comment.