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] - Dialog actions are broken. Custom components don't work in model actions #539

Open
konsti opened this issue Feb 20, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@konsti
Copy link

konsti commented Feb 20, 2025

Description

Using a custom component as a dialog action does not work. The production build always throws the error:

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: null.

The development build works without issues!

I also suspect the example from the official repo would not work, but the example has a dependency issue and cannot be installed with NPM.

I've created a minimal reproduction repo with an example.

Reproduction URL

https://github.com/konsti/next-admin-bug

Reproduction steps

1. Clone the repository
2. Run docker-compose up
3. Open http://localhost:3000/admin
4. Try to open the "Send posts to subscribers" dialog

Next router

App router

Next Admin version

7.3.0

@konsti konsti added the bug Something isn't working label Feb 20, 2025
@konsti
Copy link
Author

konsti commented Feb 21, 2025

The deployed demo is also broken: https://next-admin-po.vercel.app/

  • Try to add a post and then add a tag.

@konsti
Copy link
Author

konsti commented Feb 21, 2025

The issue could be cloneElement in https://github.com/premieroctet/next-admin/blob/main/packages/next-admin/src/components/ClientActionDialog.tsx#L115

cloneElement requires a valid React element, but we are passing a function that creates an element instead:

React docs:

element: The element argument must be a valid React element. For example, it could be a JSX node like , the result of calling createElement, or the result of another cloneElement call.

Wouldn't createElement be correct here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant