Can go back to old items list now

This commit is contained in:
Jackson Harper
2024-08-19 15:58:56 +08:00
parent 64cb4eb249
commit 5f59a1d364
2 changed files with 42 additions and 49 deletions

View File

@ -675,25 +675,18 @@ export function LibraryContainer(props: LibraryContainerProps): JSX.Element {
activeCardId ? [...ACTIVE_ACTIONS, ...UNACTIVE_ACTIONS] : UNACTIVE_ACTIONS,
[activeCardId, activeItem]
)
// useFetchMore(
// () => {
// if (!isFetching && !isLoading && hasNextPage) {
// fetchNextPage()
// }
// },
// () => {
// if (!isFetching && !isLoading && hasPreviousPage) {
// fetchPreviousPage()
// }
// }
// )
// console.log(
// 'isFetching && !isLoading, isFetchingNextPage',
// isFetching,
// isLoading,
// isFetchingNextPage
// )
useFetchMore(
() => {
if (!isFetching && !isLoading && hasNextPage) {
fetchNextPage()
}
},
() => {
if (!isFetching && !isLoading && hasPreviousPage) {
fetchPreviousPage()
}
}
)
const setIsChecked = useCallback(
(itemId: string, set: boolean) => {
@ -810,32 +803,32 @@ export function LibraryContainer(props: LibraryContainerProps): JSX.Element {
[itemsPages, multiSelectMode, checkedItems]
)
return (
<InfiniteScroll
dataLength={libraryItems.length}
next={fetchNextPage}
hasMore={hasNextPage}
loader={<h4>Loading...</h4>}
endMessage={
<p style={{ textAlign: 'center' }}>
<b>Yay! You have seen it all</b>
</p>
}
>
{libraryItems.map((item) => {
return (
<Box
key={item.node.id}
onClick={() => {
router.push(`/${viewerData?.profile.username}/${item.node.slug}`)
}}
>
{item.cursor}: {item.node.title}
</Box>
)
})}
</InfiniteScroll>
)
// return (
// <InfiniteScroll
// dataLength={libraryItems.length}
// next={fetchNextPage}
// hasMore={hasNextPage}
// loader={<h4>Loading...</h4>}
// endMessage={
// <p style={{ textAlign: 'center' }}>
// <b>Yay! You have seen it all</b>
// </p>
// }
// >
// {libraryItems.map((item) => {
// return (
// <Box
// key={item.node.id}
// onClick={() => {
// router.push(`/${viewerData?.profile.username}/${item.node.slug}`)
// }}
// >
// {item.cursor}: {item.node.title}
// </Box>
// )
// })}
// </InfiniteScroll>
// )
return (
<HomeFeedGrid