Skip to content

Commit

Permalink
Update React Query
Browse files Browse the repository at this point in the history
React Query v4 switches to a new package name, so `react-query`
is now `@tanstack/react-query`.

Breaking changes:
- all query keys must be arrays, so for example `'properties'` is
  now `['properties']`
- query data is read-only in the response from `useQuery`
- disabled queries are 'loading' by default, need to switch to
  `isInitialLoading` flag to prevent blocking page in loading state
  in case of disabled queries, e.g. Pipeline resource on PipelineRun
  page when using an inline Pipeline spec as we never need to request
  a Pipeline resource in that case
- `setLogger` removed, logger is now set as a property when defining
  the QueryClient

Package imports and most of the key updates were achieved using the
provided codemods. Some manual changes required to address the rest.

Tests updated to match including fix for infrequent flake in App.test
  • Loading branch information
AlanGreene committed Oct 7, 2022
1 parent 7705354 commit 0f6dd01
Show file tree
Hide file tree
Showing 16 changed files with 262 additions and 208 deletions.
7 changes: 0 additions & 7 deletions config_frontend/setupTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,11 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

import { setLogger } from 'react-query';
import fetch from 'node-fetch';
import { TextDecoder, TextEncoder } from 'util';

import { server } from './msw';

setLogger({
log: console.log, // eslint-disable-line no-console
warn: console.warn, // eslint-disable-line no-console
error: () => {}
});

// Establish API mocking before all tests.
beforeAll(() =>
server.listen({
Expand Down
Loading

0 comments on commit 0f6dd01

Please sign in to comment.