1- const handledPropsCache = { }
2-
31/**
42 * Push all `source` array elements to the `target` array if they don't already exist in `target`.
53 *
@@ -19,9 +17,8 @@ const pushUnique = (source, target) => source.forEach(x => {
1917 * @returns {{} } A shallow copy of the prop object
2018 */
2119const getUnhandledProps = ( Component , props ) => {
22- const { _meta : { name } , autoControlledProps, defaultProps, propTypes } = Component
23-
24- let handledProps = handledPropsCache [ name ]
20+ const { autoControlledProps, defaultProps, propTypes } = Component
21+ let { handledProps } = Component
2522
2623 // ----------------------------------------
2724 // Calculate handledProps once and cache
@@ -33,9 +30,12 @@ const getUnhandledProps = (Component, props) => {
3330 if ( defaultProps ) pushUnique ( Object . keys ( defaultProps ) , handledProps )
3431 if ( propTypes ) pushUnique ( Object . keys ( propTypes ) , handledProps )
3532
36- handledPropsCache [ name ] = handledProps
33+ Component . handledProps = handledProps
3734 }
3835
36+ // ----------------------------------------
37+ // Return _unhandled_ props
38+ // ----------------------------------------
3939 return Object . keys ( props ) . reduce ( ( acc , prop ) => {
4040 if ( handledProps . indexOf ( prop ) === - 1 ) acc [ prop ] = props [ prop ]
4141 return acc
0 commit comments