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

@ -2,20 +2,20 @@ import { Fragment, useEffect, useRef, useState } from "react";
import { ExclamationTriangleIcon } from "@heroicons/react/24/solid";
import format from "date-fns/format";
import { DebounceInput } from "react-debounce-input";
import { APIClient } from "../api/APIClient";
import { Checkbox } from "../components/Checkbox";
import { classNames, simplifyDate } from "../utils";
import { SettingsContext } from "../utils/Context";
import { EmptySimple } from "../components/emptystates";
import {
Cog6ToothIcon,
DocumentArrowDownIcon
} from "@heroicons/react/24/outline";
import { useQuery } from "react-query";
import { useQuery } from "@tanstack/react-query";
import { Menu, Transition } from "@headlessui/react";
import { baseUrl } from "../utils";
import { RingResizeSpinner } from "@/components/Icons";
import { APIClient } from "@api/APIClient";
import { Checkbox } from "@components/Checkbox";
import { classNames, simplifyDate } from "@utils";
import { SettingsContext } from "@utils/Context";
import { EmptySimple } from "@components/emptystates";
import { baseUrl } from "@utils";
import { RingResizeSpinner } from "@components/Icons";
type LogEvent = {
time: string;
@ -83,7 +83,6 @@ export const Logs = () => {
</div>
</header>
<div className="max-w-screen-xl mx-auto pb-12 px-2 sm:px-4 lg:px-8">
<div className="flex justify-center py-4">
<ExclamationTriangleIcon
@ -158,15 +157,13 @@ export const Logs = () => {
};
export const LogFiles = () => {
const { isLoading, data } = useQuery(
["log-files"],
() => APIClient.logs.files(),
{
retry: false,
refetchOnWindowFocus: false,
onError: err => console.log(err)
}
);
const { isLoading, data } = useQuery({
queryKey: ["log-files"],
queryFn: () => APIClient.logs.files(),
retry: false,
refetchOnWindowFocus: false,
onError: err => console.log(err)
});
return (
<div>
@ -224,10 +221,8 @@ const LogFilesItem = ({ file }: LogFilesItemProps) => {
URL.revokeObjectURL(url);
setIsDownloading(false);
};
return (
<li className="text-gray-500 dark:text-gray-400">
<div className="grid grid-cols-12 items-center py-2">
<div className="col-span-4 sm:col-span-5 px-2 py-0 truncate hidden sm:block sm:text-sm text-md font-medium text-gray-900 dark:text-gray-200">