-
-
Notifications
You must be signed in to change notification settings - Fork 328
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
Call custom event handlers #3073
base: next
Are you sure you want to change the base?
Call custom event handlers #3073
Conversation
🦋 Changeset detectedLatest commit: e3bff26 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@phamduylong is attempting to deploy a commit to the Skeleton Labs Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the Pagination
component, the reason the callback in conjunction with binding doesn't work is because the callbacks need to be defined at the context
level. Not the machine level.
This makes it work:
const [snapshot, send] = useMachine(
pagination.machine({
id: useId(),
count: data.length,
- onPageChange(details) {
- zagProps.onPageChange?.(details);
- page = details.page;
- },
- onPageSizeChange(details) {
- zagProps.onPageSizeChange?.(details);
- pageSize = details.pageSize;
- }
}),
{
context: {
...zagProps,
+ onPageChange(details) {
+ zagProps.onPageChange?.(details);
+ page = details.page;
+ },
+ onPageSizeChange(details) {
+ zagProps.onPageSizeChange?.(details);
+ pageSize = details.pageSize;
+ },
get page() {
return page;
},
get pageSize() {
return pageSize;
},
get count() {
// Use 'count' if specified; required for server-side pagination.
return zagProps.count ?? data.length;
}
}
}
);
Apart from that, LGTM!
Linked Issue
Closes #3064
Description
Call zagProps events whenever applicable
NOTE:
onPageSizeChange
hasn't worked for Pagination yet.Changsets
Instructions: Changesets automate our changelog. If you modify files in
/packages
, runpnpm changeset
in the root of the monorepo, follow the prompts, then commit the markdown file. Changes that add features should beminor
while chores and bugfixes should bepatch
. Please prefix the changeset message withfeat:
,bugfix:
orchore:
.Checklist
Please read and apply all contribution requirements.
dev
branch (NEVERmaster
)docs/
,feat/
,chore/
,bugfix/
pnpm ci:check
pnpm format
pnpm test