mirror of
https://github.com/tachiyomiorg/tachiyomi-extensions-inspector.git
synced 2025-01-12 08:49:08 +01:00
stop spinning if chapter list is empty
This commit is contained in:
parent
1896f7f37b
commit
3de9ccc62f
@ -58,6 +58,7 @@ export default function Manga() {
|
|||||||
|
|
||||||
const [manga, setManga] = useState<IManga>();
|
const [manga, setManga] = useState<IManga>();
|
||||||
const [chapters, setChapters] = useState<IChapter[]>([]);
|
const [chapters, setChapters] = useState<IChapter[]>([]);
|
||||||
|
const [fetchedChapters, setFetchedChapters] = useState(false);
|
||||||
const [chapterUpdateTriggerer, setChapterUpdateTriggerer] = useState(0);
|
const [chapterUpdateTriggerer, setChapterUpdateTriggerer] = useState(0);
|
||||||
|
|
||||||
function triggerChaptersUpdate() {
|
function triggerChaptersUpdate() {
|
||||||
@ -79,7 +80,8 @@ export default function Manga() {
|
|||||||
const shouldFetchOnline = chapters.length > 0 && chapterUpdateTriggerer === 0;
|
const shouldFetchOnline = chapters.length > 0 && chapterUpdateTriggerer === 0;
|
||||||
client.get(`/api/v1/manga/${id}/chapters?onlineFetch=${shouldFetchOnline}`)
|
client.get(`/api/v1/manga/${id}/chapters?onlineFetch=${shouldFetchOnline}`)
|
||||||
.then((response) => response.data)
|
.then((response) => response.data)
|
||||||
.then((data) => setChapters(data));
|
.then((data) => setChapters(data))
|
||||||
|
.then(() => setFetchedChapters(true));
|
||||||
}, [chapters.length, chapterUpdateTriggerer]);
|
}, [chapters.length, chapterUpdateTriggerer]);
|
||||||
|
|
||||||
// const itemContent = (index:any) => <InnerItem chapters={chapters} index={index} />;
|
// const itemContent = (index:any) => <InnerItem chapters={chapters} index={index} />;
|
||||||
@ -99,7 +101,7 @@ export default function Manga() {
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<LoadingPlaceholder
|
<LoadingPlaceholder
|
||||||
shouldRender={chapters.length > 0}
|
shouldRender={chapters.length > 0 || fetchedChapters}
|
||||||
>
|
>
|
||||||
<Virtuoso
|
<Virtuoso
|
||||||
style={{ // override Virtuoso default values and set them with class
|
style={{ // override Virtuoso default values and set them with class
|
||||||
|
Loading…
x
Reference in New Issue
Block a user