Skip to content

Commit 0f3ebaa

Browse files
committed
fix: Decrease Retry Fetch Time, Error Page Tweaks
Updated retry delay in axiosRetry, modified error handling in error.tsx
1 parent 5be3b60 commit 0f3ebaa

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

app/api/aniwatch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const BASE_URL = process.env.NEXT_PUBLIC_ANIWATCH_API_URL
88
// HANDLES SERVER ERRORS, most of time when server was not running due to be using the Free Tier
99
axiosRetry(Axios, {
1010
retries: 3,
11-
retryDelay: (retryAttempt) => retryAttempt * 2000,
11+
retryDelay: (retryAttempt) => retryAttempt * 1300,
1212
retryCondition: (error) => error.response?.status == 500 || error.response?.status == 503,
1313
onRetry: (retryNumber) => console.log(`retry: ${retryNumber} ${retryNumber == 3 ? " - Last Attempt" : ""}`)
1414
})

app/api/consumetGoGoAnime.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const CONSUMET_API_URL = process.env.NEXT_PUBLIC_CONSUMET_API_URL
1111
// HANDLES SERVER ERRORS, most of time when server was not running due to be using the Free Tier
1212
axiosRetry(Axios, {
1313
retries: 3,
14-
retryDelay: (retryAttempt) => retryAttempt * 2000,
14+
retryDelay: (retryAttempt) => retryAttempt * 1300,
1515
retryCondition: (error) => error.response?.status == 500 || error.response?.status == 503,
1616
onRetry: (retryNumber) => console.log(`retry: ${retryNumber} ${retryNumber == 3 ? " - Last Attempt" : ""}`)
1717
})

app/error.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import ErrorImg from "@/public/error-img-4.png"
44
import Image from 'next/image'
55
import { motion } from 'framer-motion'
66
import styles from "./errorStyles.module.css"
7+
import { usePathname } from 'next/navigation'
78

89
function ErrorPage({ error, reset }: {
910
error: Error & { digest?: string }
@@ -14,6 +15,8 @@ function ErrorPage({ error, reset }: {
1415
console.error(error)
1516
}, [error])
1617

18+
const pathname = usePathname()
19+
1720
return (
1821

1922
<div id={styles.error_container}>
@@ -28,6 +31,10 @@ function ErrorPage({ error, reset }: {
2831

2932
<p>Sometimes is due to the API Hosting! <b>Reloading Page Might Work!</b></p>
3033

34+
{pathname.slice(0, 6) == "/watch" && (
35+
<p>On videos, try to change between <b>dub</b> and <b>sub</b> options.</p>
36+
)}
37+
3138
<span>
3239
<b>{error.name}</b>: {error.message}
3340
</span>
@@ -37,7 +44,7 @@ function ErrorPage({ error, reset }: {
3744
<div id={styles.buttons_container}>
3845

3946
<motion.button
40-
onClick={() => reset()}
47+
onClick={() => window.location.reload()}
4148
whileTap={{ scale: 0.9 }}
4249
>
4350
Try again

app/my-lists/components/MediasContainer/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ function KeepWatchingListSection({ keepWatchingList, loading }: { keepWatchingLi
166166
function MediasListOnUserDoc({ userLists }: { userLists: { name: string, medias: ListItemOnMediasSaved[] }[] }) {
167167

168168
return (
169-
userLists.map((list) => (
169+
userLists?.map((list) => (
170170

171171
<div key={list.name} className={styles.list_container} id={list.name.toLowerCase()}>
172172

0 commit comments

Comments
 (0)