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
Seems that to properly use prop-types, react doesn't play nicely with props that start as null but later become a specific form. This keeps us from using prop-types as effectively as we could be using them (e.g., making generous use of .isRequired and ensuring presence of defaultProps values whenever a value isn't required.)
Seems that to properly use prop-types, react doesn't play nicely with props that start as null but later become a specific form. This keeps us from using prop-types as effectively as we could be using them (e.g., making generous use of
.isRequired
and ensuring presence ofdefaultProps
values whenever a value isn't required.)You can trace the story from here, but there have been many workarounds over years:
facebook/react#2166 (comment)
My impression is that
null
isn't really supported in the ways we're using it in places like this:https://github.com/pol-is/polisServer/blob/577dec6407470147b1c9043293ee30b85c6b335b/client-admin/src/reducers/mod_comments_accepted.js#L5-L8
where we then look for null to track when things are still loading:
https://github.com/pol-is/polisServer/blob/133e3d3b6c07ca1fddd27c414f25b382ffddc7d0/client-admin/src/components/conversation-admin/conversation-has-comments-check.js#L41
We should probably be doing one of two things:
something like this to track isLoading state outside looking for a
null
value:https://medium.com/stashaway-engineering/react-redux-tips-better-way-to-handle-loading-flags-in-your-reducers-afda42a804c6
Or using
explicitNull
custom prop-type from airbnb:Add isDefined and isNotNull parallels to isRequired facebook/prop-types#90 (comment)
The text was updated successfully, but these errors were encountered: