refactor(web): replace pkg react-query with tanstack/react-query (#868)

* refactor: move to tanstack/react-query and fix cache

* refactor(releases): move to tanstack/react-query

* refactor(logs): move to tanstack/react-query

* refactor(base): move to tanstack/react-query

* refactor(base): move to tanstack/react-query

* refactor(dashboard): move to tanstack/react-query

* refactor(auth): move to tanstack/react-query

* refactor(filters): move to tanstack/react-query

* refactor(settings): move to tanstack/react-query

* chore(pkg): add tanstack/react-query

* refactor(filters): move to tanstack/react-query

* refactor: move to tanstack/react-query

* refactor: invalidate queries

* chore(pkg): remove old react-query

* chore: change imports to root prefixes

* build: remove needs web from test

* set enableReinitialize to true to fix formik caching issues

* fix all property for apiKeys const

* fix toast when enabling/disabling feed

---------

Co-authored-by: martylukyy <35452459+martylukyy@users.noreply.github.com>
This commit is contained in:
ze0s 2023-04-27 21:26:27 +02:00 committed by GitHub
parent 0be92bef65
commit 6e5385a490
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
54 changed files with 1101 additions and 1117 deletions

View file

@ -1,5 +1,5 @@
import * as React from "react";
import { useQuery } from "react-query";
import { useQuery } from "@tanstack/react-query";
import {
useTable,
useFilters,
@ -8,11 +8,10 @@ import {
usePagination, FilterProps, Column
} from "react-table";
import { APIClient } from "../../api/APIClient";
import { EmptyListState } from "../../components/emptystates";
import * as Icons from "../../components/Icons";
import * as DataTable from "../../components/data-table";
import { APIClient } from "@api/APIClient";
import { EmptyListState } from "@components/emptystates";
import * as Icons from "@components/Icons";
import * as DataTable from "@components/data-table";
// This is a custom filter UI for selecting
// a unique option from a list
@ -74,8 +73,9 @@ function Table({ columns, data }: TableProps) {
usePagination
);
if (!page.length)
if (!page.length) {
return <EmptyListState text="No recent activity" />;
}
// Render the UI for your table
return (
@ -178,24 +178,25 @@ export const ActivityTable = () => {
}
], []);
const { isLoading, data } = useQuery(
"dash_recent_releases",
() => APIClient.release.findRecent(),
{ refetchOnWindowFocus: false }
);
const { isLoading, data } = useQuery({
queryKey: ["dash_recent_releases"],
queryFn: APIClient.release.findRecent,
refetchOnWindowFocus: false
});
if (isLoading)
if (isLoading) {
return (
<div className="flex flex-col mt-12">
<h3 className="text-2xl font-medium leading-6 text-gray-900 dark:text-gray-200">
&nbsp;
&nbsp;
</h3>
<div className="animate-pulse text-black dark:text-white">
<EmptyListState text="Loading..." />
<EmptyListState text="Loading..."/>
</div>
</div>
);
}
return (
<div className="flex flex-col mt-12">
<h3 className="text-2xl font-medium leading-6 text-gray-900 dark:text-gray-200">