Talend/ui

Missing displayName can cause issues with cmf's component states.

sgangnant opened this issue · 1 comments

Seen with @jmfrancois

We've encountered a case where, once the code minified, containers with no displayName attribute couldn't properly read their component state from cmf (due to their minified name).

displayName should be, for such components/containers, a requirement.

So if a React component is cmfConnected it needs a displayName for two reasons:

  • CMF must be able to get the current component name to read in the settings the props to apply to it.
  • CMF must be able to create an entry in state.cmf.components redux state to store the component state in it.

So mainly to let the framework do things with it.

Why do not just use the function name ?
This is already the case but when you pass in production you uglify the code, so all the component are just call t. So some component will share state.cmf.components.get('t').get('default') and will not found their settings.

Why not just throw exception if the displayName is not passed.
Because it would be a breaking change.