Skip to content

Commit

Permalink
fix: unable to load the second piece of data
Browse files Browse the repository at this point in the history
  • Loading branch information
Ray-D-Song committed Oct 31, 2024
1 parent 5774b14 commit 96feb52
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
11 changes: 1 addition & 10 deletions packages/web/src/pages/(layout)/folder.[slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { useNavigate, useParams } from '~/router'
import NotFound from '~/components/not-found'
import LoadingWrapper from '~/components/loading-wrapper'
import { deletePage, queryPage } from '~/data/page'
import emitter from '~/utils/emitter'
import CardView from '~/components/card-view'
import EmptyWrapper from '~/components/empty-wrapper'
import ListView from '~/components/list-view'
Expand Down Expand Up @@ -44,7 +43,7 @@ function FolderPage() {
isNoMore: (d) => {
if (!d)
return false
return d.pageNumber > (d.total / PAGE_SIZE)
return d.list.length >= d.total || d.pageNumber > Math.ceil(d.total / PAGE_SIZE)
},
},
)
Expand All @@ -59,14 +58,6 @@ function FolderPage() {
},
})

emitter.on('movePage', ({
pageId,
folderId,
}) => {
if (folderId !== Number(slug))
setPageData({ list: pagesData?.list.filter(page => page.id !== pageId) ?? [] })
})

const navigate = useNavigate()
const handleItemClick = (page: Page) => {
navigate(`/page/:slug`, { params: { slug: String(page.id) } })
Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/pages/showcase/folder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function ShowcaseFolderPage() {
isNoMore: (d) => {
if (!d)
return false
return d.pageNumber > (d.total / PAGE_SIZE)
return d.list.length >= d.total || d.pageNumber > Math.ceil(d.total / PAGE_SIZE)
},
},
)
Expand Down

0 comments on commit 96feb52

Please sign in to comment.