developit / developit/unistore

Connected components loses its original name

Open
#128 1 comment 0 reactions 0 assignees View on GitHub
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 = () =>

Foo
;
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.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.