ui icon indicating copy to clipboard operation
ui copied to clipboard

fix(4710): Introduce safe access OTPInputContext slot array with custom hook

Open timges opened this issue 1 year ago • 3 comments

Description

This PR resolves an issue where the TypeScript compiler fails to build the InputOTP component due to unsafe access of the OTPInputContext's slot array.

To address this, the array access logic has been refactored into a custom hook that includes proper type guarding and error handling. This ensures safer access and improves overall code quality.

Fixes https://github.com/shadcn-ui/ui/issues/4710

Type of change

  • [x] Bug fix (non-breaking change which fixes an issue)

Checklist:

  • [x] Changed both default and new-york styles
  • [x] Passed check script
  • [x] Passed tests
  • [x] Rebuilt the registry

timges avatar Sep 08 '24 16:09 timges

@timges is attempting to deploy a commit to the shadcn-pro Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Sep 08 '24 16:09 vercel[bot]

Hey @shadcn would be great if you could take a small look on this, once you have some spare time. I think it's a pretty quick and easy fix for an annoying issue 🙂

timges avatar Oct 10 '24 08:10 timges

Fixes: #3585 too

Mathieu-COSYNS avatar Jan 18 '25 16:01 Mathieu-COSYNS