(newProps: Partial<PropsT>)
| 43 | |
| 44 | // clone this layer with modified props |
| 45 | clone(newProps: Partial<PropsT>) { |
| 46 | const {props} = this; |
| 47 | |
| 48 | // Async props cannot be copied with Object.assign, copy them separately |
| 49 | const asyncProps: Partial<PropsT> = {}; |
| 50 | |
| 51 | // See async props definition in create-props.js |
| 52 | for (const key in props[ASYNC_DEFAULTS_SYMBOL]) { |
| 53 | if (key in props[ASYNC_RESOLVED_SYMBOL]) { |
| 54 | asyncProps[key] = props[ASYNC_RESOLVED_SYMBOL][key]; |
| 55 | } else if (key in props[ASYNC_ORIGINAL_SYMBOL]) { |
| 56 | asyncProps[key] = props[ASYNC_ORIGINAL_SYMBOL][key]; |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | // Some custom layer implementation may not support multiple arguments in the constructor |
| 61 | // @ts-ignore |
| 62 | return new this.constructor({...props, ...asyncProps, ...newProps}); |
| 63 | } |
| 64 | } |
no outgoing calls
no test coverage detected