It seems like some components that filter their children might end up getting item.type equal to undefined.
I have seen this happen when a component that applies a filter contains children separated by a space on the same line.
Possible solution
Replace all instances of item.type.name === ComponentX.name with a more robust check which checks item.type && item.type.name && item.type.name === ComponentX.name instead. This will safeguard against this particular problem and possibly others in the future.
It seems like some components that filter their
children
might end up gettingitem.type
equal toundefined
.I have seen this happen when a component that applies a filter contains children separated by a space on the same line.
Possible solution
Replace all instances of
item.type.name === ComponentX.name
with a more robust check which checksitem.type && item.type.name && item.type.name === ComponentX.name
instead. This will safeguard against this particular problem and possibly others in the future.