developit / developit/unistore
Connected components loses its original name
- Dominant language
- JavaScript
- Stars
- 2.8k
- Forks
- 134
- PR merge metrics
- No merged PRs in 30d
Description
It seems that connecting a component will mean that it loses its original name. Down below is a test case where I was able to reproduce it.
```
it('should not affect display name', () => {
const Child = () =>
const ConnectedChild = connect(Object)(Child);
expect(Child.name).toEqual('Child');
expect(ConnectedChild.name).toEqual('Child'); // becomes "Wrapper"
});
```
The reason this is a problem for us is because we're using shallow render in some test cases to only render a certain amount of levels of depth to verify that a correct component was mounted, but unfortunately the name is lost unless we explicitly set `displayName` on the connected component before exporting and rendering it.
EDIT: Forgot to mention that is using Preact.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.