mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 16:59:12 +00:00
feat(web): migrate Tanstack Query to v5 (#1277)
* feat: migrate to v5 * refactor: Revise error handling in QueryClient for compatibility with React Query v5 The `useErrorBoundary` option has been renamed to `throwOnError` and suspense have been removed: more on suspense more on suspense. https://tanstack.com/query/v5/docs/react/guides/migrating-to-v5#new-hooks-for-suspense * refactor: Callbacks on useQuery (and QueryObserver) have been removed onSuccess, onError and onSettled have been removed from Queries. They haven't been touched for Mutations. Please see this https://github.com/TanStack/query/discussions/5279 for motivations behind this change and what to do instead. * refactor: change to isPending, isLoading have been renamed for mutations. Also, they are using object now: - useQuery(key, fn, options) + useQuery({ queryKey, queryFn, ...options }) * refactor: change to placeHolderData. Removed keepPreviousData in favor of placeholderData identity function https://tanstack.com/query/v5/docs/react/guides/migrating-to-v5#removed-keeppreviousdata-in-favor-of-placeholderdata-identity-function * fix: useSuspenseQuery instead of useQuery. * fix(web): more useSuspenseQuery substitutions * whoops - nobody saw that okay? * fix pnpm lockfile * fix pnpm lockfile again --------- Co-authored-by: martylukyy <35452459+martylukyy@users.noreply.github.com> Co-authored-by: soup <soup@r4tio.dev>
This commit is contained in:
parent
e63aec1ab2
commit
db7ab7c99a
23 changed files with 349 additions and 439 deletions
|
@ -4,7 +4,7 @@
|
|||
*/
|
||||
|
||||
import React, { useState } from "react";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { useSuspenseQuery } from "@tanstack/react-query";
|
||||
import {
|
||||
useTable,
|
||||
useFilters,
|
||||
|
@ -18,7 +18,7 @@ import { EmptyListState } from "@components/emptystates";
|
|||
import * as Icons from "@components/Icons";
|
||||
import { EyeIcon, EyeSlashIcon } from "@heroicons/react/24/solid";
|
||||
import * as DataTable from "@components/data-table";
|
||||
import { RandomLinuxIsos } from "@utils/index";
|
||||
import { RandomLinuxIsos } from "@utils";
|
||||
|
||||
// This is a custom filter UI for selecting
|
||||
// a unique option from a list
|
||||
|
@ -185,12 +185,15 @@ export const ActivityTable = () => {
|
|||
}
|
||||
], []);
|
||||
|
||||
const { isLoading, data } = useQuery({
|
||||
const { isLoading, data } = useSuspenseQuery({
|
||||
queryKey: ["dash_recent_releases"],
|
||||
queryFn: APIClient.release.findRecent,
|
||||
refetchOnWindowFocus: false
|
||||
});
|
||||
|
||||
const [modifiedData, setModifiedData] = useState<Release[]>([]);
|
||||
const [showLinuxIsos, setShowLinuxIsos] = useState(false);
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
<div className="flex flex-col mt-12">
|
||||
|
@ -204,10 +207,6 @@ export const ActivityTable = () => {
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
const [modifiedData, setModifiedData] = useState<Release[]>([]);
|
||||
const [showLinuxIsos, setShowLinuxIsos] = useState(false);
|
||||
|
||||
const toggleReleaseNames = () => {
|
||||
setShowLinuxIsos(!showLinuxIsos);
|
||||
if (!showLinuxIsos && data && data.data) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue