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

GridList renderEmptyState cannot be a Component with Hooks #7010

Open
ArrayKnight opened this issue Sep 9, 2024 · 2 comments
Open

GridList renderEmptyState cannot be a Component with Hooks #7010

ArrayKnight opened this issue Sep 9, 2024 · 2 comments

Comments

@ArrayKnight
Copy link

Provide a general summary of the issue here

Somewhere between version 1.2.1 and 1.3.1, a breaking change was introduced that made it so that the renderEmptyState prop can no longer accept a component that contains a hook

🤔 Expected Behavior?

To be honest, I'm split on whether this expected or not. In RAC v1.2.1, renderDropIndicator on the drag and drop hooks for GridList had the same restriction. Not desirable then either though...

It would be nice to be able to pass standard components in both of these cases

😯 Current Behavior

Passing a component that utilizes react hooks will cause React to throw a rules of hooks error

💁 Possible Solution

No response

🔦 Context

No response

🖥️ Steps to Reproduce

https://codesandbox.io/p/sandbox/hidden-monad-r587g3

Version

RAC @ 1.3.1

What browsers are you seeing the problem on?

Chrome

If other, please specify.

No response

What operating system are you using?

Mac & Windows

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

@snowystinger
Copy link
Member

Thanks for the issue. Seems fine if you pull it out into a component instead of trying to inline it
https://codesandbox.io/p/sandbox/happy-firefly-f8hfqv?file=%2Fsrc%2FApp.js

Something about how it's invoked seems to have changed, but I haven't spotted the difference yet.

@ArrayKnight
Copy link
Author

Ah, interesting, the way I had been using it previously was more along the lines of passing the component directly:
https://codesandbox.io/p/sandbox/great-roentgen-5tjv3f?file=%2Fsrc%2FApp.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants