diff --git a/src/client/package.json b/src/client/package.json index 8424c1a..1c4b210 100644 --- a/src/client/package.json +++ b/src/client/package.json @@ -2,6 +2,9 @@ "name": "ionian_client", "version": "0.0.1", "description": "client of ionian", + "scripts": { + "build:watch": "ts-node build.ts" + }, "dependencies": { "@emotion/react": "^11.9.0", "@emotion/styled": "^11.8.1", diff --git a/src/client/page/gallery.tsx b/src/client/page/gallery.tsx index 141ef20..e6fd441 100644 --- a/src/client/page/gallery.tsx +++ b/src/client/page/gallery.tsx @@ -18,8 +18,10 @@ type GalleryState = { export const GalleryInfo = (props: GalleryProp) => { const [state, setState] = useState({ documents: undefined }); + const [loadAll, setLoadAll] = useState(false); useEffect(() => { const abortController = new AbortController(); + console.log('load first',props.option); const load = (async () => { const c = await ContentAccessor.findList(props.option); //todo : if c is undefined, retry to fetch 3 times. and show error message. @@ -52,7 +54,7 @@ export const GalleryInfo = (props: GalleryProp) => { gallery={`/search?${queryString}`} short />); }) } - + ); function loadMore() { @@ -61,7 +63,12 @@ export const GalleryInfo = (props: GalleryProp) => { console.log("load more", option); const load = (async () => { const c = await ContentAccessor.findList(option); - setState({ documents: [...state.documents, ...c] }); + if (c.length === 0) { + setLoadAll(true); + } + else{ + setState({ documents: [...state.documents, ...c] }); + } }); load(); }