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

Dockview does not support React.memo for components #498

Closed
patrickemoore opened this issue Feb 9, 2024 · 2 comments · Fixed by #499
Closed

Dockview does not support React.memo for components #498

patrickemoore opened this issue Feb 9, 2024 · 2 comments · Fixed by #499
Labels
enhancement New feature or request
Milestone

Comments

@patrickemoore
Copy link

Describe the bug.

Hi there!

I have several functional components in the Dockview "components" prop which are wrapped in React.memo for performance.

const ExampleComponent = memo(function ExampleComponent() { return <>Example JSX</>; });

This throws the following error in the JS console, coming from dockview

image

I was hoping to get support for these components, or maybe you can elaborate on why these are deliberately not supported if that's the case.

To Reproduce

Steps to reproduce the behavior:

  1. Register any functional component wrapped in React.memo into Dockview
  2. Render a pane with that component

Expected behavior

Not error

@mathuo mathuo linked a pull request Feb 9, 2024 that will close this issue
@mathuo
Copy link
Owner

mathuo commented Feb 9, 2024

Thanks for rasing the issue!

There is no reason dockview should not support components wrapped in React.memo. I will get this changed, the current check is very old, not particularly clever and simply checks if the input is typeof function.

The reason dockview is explictly checking is that if we don't React will throw very obsure errors if a user does pass in something that is not a React component by mistake.

@mathuo mathuo added the enhancement New feature or request label Feb 9, 2024
@mathuo mathuo reopened this Feb 9, 2024
@mathuo mathuo added this to the v1.10.0 milestone Feb 9, 2024
@mathuo
Copy link
Owner

mathuo commented Feb 25, 2024

Released in 1.10.0 https://dockview.dev/

@mathuo mathuo closed this as completed Feb 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants