You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, when a property is requested in mapDataToProps, but it is missing in the data, the result is that the component does not render and no error is emitted.
This can make debugging quite hard. When I can't see a view, there can be many possible causes:
Is my view registered correctly?
Does the type of the data matches my View?
Do I have any typo's in my View? (can happen in mapDataToProps, in the props of the component, in the proptypes / interface)
Is some prop missing in the data?
We might be able to rule out the last two by setting forceRender to true, and checking the logs:
MyComponent.linkOpts={forceRender: true,};
But I feel like this should not be necessary.
Possible default behaviors for when a mapDataToProps prop is missing in the data:
Render an Error component / throw error (in console)
The text was updated successfully, but these errors were encountered:
joepio
changed the title
Change default behavior when mapDataToProps component misses
Change default behavior when mapDataToProps property is missing
Aug 28, 2019
Logging a message notifying the user will be trivial to implement (and no change in behaviour 👍🏻).
Render an Error component
This would seam less OWA, so that would go against project goals. Though the current behaviour has limited usability, it does prevent unnecessary error views being rendered while still allowing the developer the option to manage missing data explicitly.
Render another View
It'd be neat to render a different view (It'd be akin to using a shape to qualify a view for selection), but that would be a very large overhaul (and make view selection significantly slower).
Currently, when a property is requested in mapDataToProps, but it is missing in the data, the result is that the component does not render and no error is emitted.
This can make debugging quite hard. When I can't see a view, there can be many possible causes:
We might be able to rule out the last two by setting forceRender to true, and checking the logs:
But I feel like this should not be necessary.
Possible default behaviors for when a mapDataToProps prop is missing in the data:
The text was updated successfully, but these errors were encountered: