-
-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug in Pagination component if count < 6 #461
Comments
I can confirm the issue |
@pgswow you didn't provide Here's a fixed demo |
Well, removing fixedItems is not a fix. PS: filed a PR that fixes it. |
…ngs count for low total count as no ellipses are necessary if the total count is lower than 2x siblingCount + boundaries and potential when items are fixed, we can just render only the count directly. fix kobaltedev#461
Please investigate another issue: when you delete last item on a page>=2, the pagination component will crash, showing some error //
return (
<>
<Show when={showFirst()}>{context.renderItem(1)}</Show>
<Show when={showFirstEllipsis()}>{context.renderEllipsis()}</Show>
<For each={[...Array(previousSiblingCount()).keys()].reverse()}>
{(offset) => <>{context.renderItem(context.page() - (offset + 1))}</>}
</For>
{context.renderItem(context.page())}
{'RIGHT HERE'}
<For each={[...Array(nextSiblingCount()).keys()]}>
{(offset) => <>{context.renderItem(context.page() + (offset + 1))}</>}
</For>
{'RIGHT HERE'}
<Show when={showLastEllipsis()}>{context.renderEllipsis()}</Show>
<Show when={showLast()}>{context.renderItem(context.count())}</Show>
</>
); |
Well that's probably because you pass a page to the Pagination component which does not exist anymore after removing the item. count={ Math.ceil( items().length / 10 )}
page={currentPage}
... Now if you delete the last item you'll only have 1x page left but page still points to page 2 - thus the error. count={ Math.ceil( items().length / 10 )}
page={Math.min(currentPage, Math.ceil( items().length / 10 ))}
... Now page can't be bigger than count. const delete = (index:number) => {
...
setCurrentPage(prev => Math.min(prev, items().length / 10))
} I've added a fix for the internal page as well. So the PR will cover this as well. |
@madaxen86 I don't need to do anything, I already recoded the component set with ARK-UI and it works as I expected. I would suggest that you turn all incoming props to signals and the problem will solve itself. |
Hello! in Ark-UI is your Select component working? it doesn't pass the hidden field to the form |
I didn't test that yet. |
Check it out, you might be surprised that it doesn’t work the way it should logically work =) the Ark-ui community neither on discord nor on github comments anything about this =( |
Hello! i use pagination component with fixedItems props. if count={} of total pages <= 6 i see this (on screen shot). can this be fixed?
Reproduce: https://stackblitz.com/edit/solidjs-templates-h6gz6h?file=src%2FApp.jsx
The text was updated successfully, but these errors were encountered: