Migrate react-query to v5
This commit is contained in:
21 files changed
+66
-86
No files matched your search
@@ -162,7 +162,7 @@ const MusicAlbumTitlePage = () => {
|
||||
}
|
||||
}, [item.isSuccess]);
|
||||
|
||||
if (item.isLoading || similarItems.isLoading) {
|
||||
if (item.isPending || similarItems.isPending) {
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
@@ -198,7 +198,7 @@ const MusicAlbumTitlePage = () => {
|
||||
audioPlayButton
|
||||
cardType="square"
|
||||
/>
|
||||
{musicTracks.isLoading ? (
|
||||
{musicTracks.isPending ? (
|
||||
<></>
|
||||
) : (
|
||||
musicTracks.data.TotalRecordCount > 0 && (
|
||||
|
||||
@@ -159,9 +159,9 @@ const ArtistTitlePage = () => {
|
||||
}
|
||||
}
|
||||
}, [
|
||||
artistDiscography.isLoading,
|
||||
artistSongs.isLoading,
|
||||
artistAppearances.isLoading,
|
||||
artistDiscography.isPending,
|
||||
artistSongs.isPending,
|
||||
artistAppearances.isPending,
|
||||
]);
|
||||
|
||||
const [animationDirection, setAnimationDirection] = useState("forward");
|
||||
@@ -180,7 +180,7 @@ const ArtistTitlePage = () => {
|
||||
}
|
||||
}, [item.isSuccess]);
|
||||
|
||||
if (item.isLoading) {
|
||||
if (item.isPending) {
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
|
||||
@@ -132,7 +132,7 @@ const BoxSetTitlePage = () => {
|
||||
}
|
||||
}, [item.isSuccess]);
|
||||
|
||||
if (item.isLoading || similarItems.isLoading) {
|
||||
if (item.isPending || similarItems.isPending) {
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
|
||||
@@ -158,7 +158,7 @@ const EpisodeTitlePage = () => {
|
||||
}
|
||||
}, [item.isSuccess]);
|
||||
|
||||
if (item.isLoading) {
|
||||
if (item.isPending) {
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
|
||||
@@ -177,7 +177,7 @@ const Home = () => {
|
||||
}}
|
||||
>
|
||||
<ErrorBoundary fallback={<CarouselSlideError />}>
|
||||
{latestMedia.isLoading ? (
|
||||
{latestMedia.isPending ? (
|
||||
<CarouselSkeleton />
|
||||
) : (
|
||||
<Carousel
|
||||
@@ -224,7 +224,7 @@ const Home = () => {
|
||||
</div>
|
||||
}
|
||||
>
|
||||
{libraries.isLoading ? (
|
||||
{libraries.isPending ? (
|
||||
<CardsSkeleton />
|
||||
) : (
|
||||
<CardScroller
|
||||
@@ -279,7 +279,7 @@ const Home = () => {
|
||||
</div>
|
||||
}
|
||||
>
|
||||
{upNextItems.isLoading ? (
|
||||
{upNextItems.isPending ? (
|
||||
<CardsSkeleton />
|
||||
) : upNextItems.isSuccess &&
|
||||
upNextItems.data.Items.length == 0 ? (
|
||||
@@ -373,7 +373,7 @@ const Home = () => {
|
||||
</div>
|
||||
}
|
||||
>
|
||||
{resumeItemsVideo.isLoading ? (
|
||||
{resumeItemsVideo.isPending ? (
|
||||
<CardsSkeleton />
|
||||
) : resumeItemsVideo.isSuccess &&
|
||||
resumeItemsVideo.data.Items.length == 0 ? (
|
||||
@@ -468,7 +468,7 @@ const Home = () => {
|
||||
</div>
|
||||
}
|
||||
>
|
||||
{resumeItemsAudio.isLoading ? (
|
||||
{resumeItemsAudio.isPending ? (
|
||||
<CardsSkeleton />
|
||||
) : resumeItemsAudio.isSuccess &&
|
||||
resumeItemsAudio.data.Items.length == 0 ? (
|
||||
|
||||
@@ -185,7 +185,7 @@ const ItemDetail = () => {
|
||||
}
|
||||
}, [item.isSuccess]);
|
||||
|
||||
if (item.isLoading || similarItems.isLoading) {
|
||||
if (item.isPending || similarItems.isPending) {
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
|
||||
@@ -375,7 +375,7 @@ const LibraryView = () => {
|
||||
sx={{ mr: 2, flexShrink: 0 }}
|
||||
noWrap
|
||||
>
|
||||
{currentLib.isLoading ? (
|
||||
{currentLib.isPending ? (
|
||||
<CircularProgress sx={{ p: 1 }} />
|
||||
) : (
|
||||
currentLib.data.Items[0].Name
|
||||
@@ -383,7 +383,7 @@ const LibraryView = () => {
|
||||
</Typography>
|
||||
<Chip
|
||||
label={
|
||||
items.isLoading ? (
|
||||
items.isPending ? (
|
||||
<CircularProgress sx={{ p: 1.5 }} />
|
||||
) : (
|
||||
items.data.TotalRecordCount
|
||||
@@ -1247,7 +1247,7 @@ const LibraryView = () => {
|
||||
</Popper>
|
||||
</div>
|
||||
</div>
|
||||
{items.isLoading ? (
|
||||
{items.isPending ? (
|
||||
<Box
|
||||
sx={{
|
||||
position: "absolute",
|
||||
|
||||
@@ -239,7 +239,7 @@ export const UserLogin = () => {
|
||||
enabled: Boolean(api),
|
||||
});
|
||||
|
||||
if (users.isLoading) {
|
||||
if (users.isPending) {
|
||||
return <LinearProgress />;
|
||||
}
|
||||
if (users.isSuccess) {
|
||||
@@ -407,7 +407,7 @@ export const UserLoginManual = () => {
|
||||
|
||||
return (
|
||||
<>
|
||||
{server.isLoading && <LinearProgress />}
|
||||
{server.isPending && <LinearProgress />}
|
||||
<AppBarBackOnly />
|
||||
<Container
|
||||
maxWidth="xs"
|
||||
@@ -425,7 +425,7 @@ export const UserLoginManual = () => {
|
||||
justifyContent="center"
|
||||
alignItems="center"
|
||||
sx={{
|
||||
opacity: server.isLoading ? 0 : 1,
|
||||
opacity: server.isPending ? 0 : 1,
|
||||
transition: "opacity 200ms",
|
||||
width: "100%",
|
||||
}}
|
||||
|
||||
@@ -228,11 +228,11 @@ const PersonTitlePage = () => {
|
||||
}
|
||||
}
|
||||
}, [
|
||||
personMovies.isLoading,
|
||||
personShows.isLoading,
|
||||
personBooks.isLoading,
|
||||
personPhotos.isLoading,
|
||||
personEpisodes.isLoading,
|
||||
personMovies.isPending,
|
||||
personShows.isPending,
|
||||
personBooks.isPending,
|
||||
personPhotos.isPending,
|
||||
personEpisodes.isPending,
|
||||
]);
|
||||
const [setAppBackdrop] = useBackdropStore((state) => [state.setBackdrop]);
|
||||
|
||||
@@ -250,7 +250,7 @@ const PersonTitlePage = () => {
|
||||
}
|
||||
}, [item.isSuccess]);
|
||||
|
||||
if (item.isLoading) {
|
||||
if (item.isPending) {
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
|
||||
@@ -734,7 +734,7 @@ export const VideoPlayer = () => {
|
||||
onClick={handlePlayPrevEpisode}
|
||||
disabled={
|
||||
seriesId
|
||||
? episodes.isLoading ||
|
||||
? episodes.isPending ||
|
||||
currentEpisodeIndex == 0
|
||||
: true
|
||||
}
|
||||
@@ -770,7 +770,7 @@ export const VideoPlayer = () => {
|
||||
onClick={handlePlayNextEpisode}
|
||||
disabled={
|
||||
seriesId
|
||||
? episodes.isLoading ||
|
||||
? episodes.isPending ||
|
||||
episodes.data
|
||||
?.TotalRecordCount ==
|
||||
currentEpisodeIndex +
|
||||
|
||||
@@ -125,7 +125,7 @@ const PlaylistTitlePage = () => {
|
||||
}
|
||||
}, [item.isSuccess]);
|
||||
|
||||
if (item.isLoading || similarItems.isLoading) {
|
||||
if (item.isPending || similarItems.isPending) {
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
@@ -160,7 +160,7 @@ const PlaylistTitlePage = () => {
|
||||
audioPlayButton
|
||||
cardType="square"
|
||||
/>
|
||||
{musicTracks.isLoading ? (
|
||||
{musicTracks.isPending ? (
|
||||
<></>
|
||||
) : (
|
||||
musicTracks.data.TotalRecordCount > 0 &&
|
||||
|
||||
@@ -198,13 +198,13 @@ const SearchPage = () => {
|
||||
Boolean(
|
||||
searchTerm,
|
||||
) &&
|
||||
(movies.isLoading ||
|
||||
series.isLoading ||
|
||||
audio.isLoading ||
|
||||
musicAlbum.isLoading ||
|
||||
musicArtists.isLoading ||
|
||||
person.isLoading ||
|
||||
book.isLoading)
|
||||
(movies.isPending ||
|
||||
series.isPending ||
|
||||
audio.isPending ||
|
||||
musicAlbum.isPending ||
|
||||
musicArtists.isPending ||
|
||||
person.isPending ||
|
||||
book.isPending)
|
||||
? 1
|
||||
: 0,
|
||||
}}
|
||||
|
||||
@@ -211,7 +211,7 @@ const SeriesTitlePage = () => {
|
||||
}
|
||||
}, [item.isSuccess]);
|
||||
|
||||
if (item.isLoading || similarItems.isLoading) {
|
||||
if (item.isPending || similarItems.isPending) {
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
@@ -285,7 +285,7 @@ const SeriesTitlePage = () => {
|
||||
</CardScroller>
|
||||
)}
|
||||
|
||||
{seasons.isLoading ? (
|
||||
{seasons.isPending ? (
|
||||
<SeasonSelectorSkeleton />
|
||||
) : (
|
||||
<div className="item-series-seasons-container">
|
||||
@@ -313,7 +313,7 @@ const SeriesTitlePage = () => {
|
||||
</Typography>
|
||||
<Chip
|
||||
label={
|
||||
episodes.isLoading ? (
|
||||
episodes.isPending ? (
|
||||
<CircularProgress
|
||||
size={20}
|
||||
style={{
|
||||
@@ -417,7 +417,7 @@ const SeriesTitlePage = () => {
|
||||
</div>
|
||||
<Divider />
|
||||
<div className="item-detail-episodes-container">
|
||||
{episodes.isLoading ? (
|
||||
{episodes.isPending ? (
|
||||
<EpisodeCardsSkeleton />
|
||||
) : (
|
||||
episodes.data.Items.map((episode) => {
|
||||
|
||||
@@ -88,7 +88,7 @@ export const ServerSetup = () => {
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
opacity: checkServer.isLoading ? 1 : 0,
|
||||
opacity: checkServer.isPending ? 1 : 0,
|
||||
transition: "opacity 350ms",
|
||||
}}
|
||||
/>
|
||||
@@ -96,7 +96,7 @@ export const ServerSetup = () => {
|
||||
maxWidth="sm"
|
||||
className={"centered serverContainer"}
|
||||
style={{
|
||||
opacity: checkServer.isLoading ? "0.5" : "1",
|
||||
opacity: checkServer.isPending ? "0.5" : "1",
|
||||
transition: "opacity 350ms",
|
||||
}}
|
||||
>
|
||||
@@ -126,7 +126,7 @@ export const ServerSetup = () => {
|
||||
variant="contained"
|
||||
sx={{ width: "100%" }}
|
||||
size="large"
|
||||
loading={checkServer.isLoading}
|
||||
loading={checkServer.isPending}
|
||||
endIcon={
|
||||
<SvgIcon>
|
||||
<path d={mdiChevronRight}></path>
|
||||
|
||||
Reference in new issue
Block a user