Skip to content
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] - DropdownTrigger and PopoverTrigger pass onClick to Button causing console warning #4399

Closed
notthatnathan opened this issue Dec 18, 2024 · 2 comments
Labels
📦 Scope : Components Related to the components ✨ Type: Enhancement New enhancement on existing codebase

Comments

@notthatnathan
Copy link

notthatnathan commented Dec 18, 2024

NextUI Version

2.6.8

Describe the bug

Button's onClick is deprecated but DropdownTrigger and maybe PopoverTrigger are passing an onClick prop to their one child, usually a Button. This causes the deprecation warning to be logged even though no direct Button instances are using onClick.

Your Example Website or App

No response

Steps to Reproduce the Bug or Issue

  1. Set up a dropdown with Button as trigger
  2. Observe console

Expected behavior

I expect no warnings.

Screenshots or Videos

CleanShot 2024-12-18 at 14 21 39@2x

image

Ignore the exact error, that's because the warn assumes process and Vite doesn't surface that.

if (process.env.NODE_ENV !== "production") {

Stack shows error comes from deprecation check here:

Operating System Version

macOS

Browser

Chrome

@wingkwong
Copy link
Member

For "process is not defined" issue, it has been fixed in canary and will be available in the next bug fix release.

To the original issue, another example would be using a polymorphic button. The onClick is passed from the Button component internally. We need to handle this case to avoid confusion (since users don't actually use onClick in their code).

@wingkwong wingkwong added ✨ Type: Enhancement New enhancement on existing codebase 📦 Scope : Components Related to the components labels Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 Scope : Components Related to the components ✨ Type: Enhancement New enhancement on existing codebase
Projects
None yet
Development

No branches or pull requests

3 participants