Skip to content

Add totalPages and currentPage to ref imperative handle#1103

Open
TSMMark wants to merge 1 commit intoFormidableLabs:mainfrom
TSMMark:patch-1
Open

Add totalPages and currentPage to ref imperative handle#1103
TSMMark wants to merge 1 commit intoFormidableLabs:mainfrom
TSMMark:patch-1

Conversation

@TSMMark
Copy link
Copy Markdown

@TSMMark TSMMark commented Feb 12, 2026

I can tidy up this PR if the maintainers would accept this addition. Let me know

Description

Need access to totalPages and currentPage in outer component.

Specifically when multiple slides may be visible per page. The internal totalPages calculation logic needs to be exposed

Fixes # (issue)

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

todo

Checklist

  • My code follows the style guidelines of this project (I have run pnpm run lint)
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes (I have run pnpm run test:ci-with-server/pnpm run test)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have recorded any user-facing fixes or changes with pnpm changeset.
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

@vercel
Copy link
Copy Markdown

vercel bot commented Feb 12, 2026

@TSMMark is attempting to deploy a commit to the formidable-labs Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Feb 12, 2026

⚠️ No Changeset found

Latest commit: b0ae189

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Exposes carousel pagination state via the forwarded ref so parent components can read totalPages and currentPage (useful when multiple slides are visible per page).

Changes:

  • Adds totalPages and currentPage to the object returned by useImperativeHandle.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +124 to 130
useImperativeHandle(ref, () => ({ goForward, goBack, goToPage, totalPages, currentPage }), [
goForward,
goBack,
goToPage,
totalPages,
currentPage
]);
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useImperativeHandle is typed with forwardRef<SlideHandle, ...>, but SlideHandle (in packages/nuka/src/types.ts) currently only includes goForward/goBack/goToPage. Returning an object literal with totalPages and currentPage will fail TypeScript excess-property checking here. Please extend SlideHandle to include these new numeric fields (and ensure the public type export is updated accordingly).

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants