(props)
| 196 | return function wrapWithConnect(WrappedComponent) { |
| 197 | class RefetchConnect extends Component { |
| 198 | constructor(props) { |
| 199 | super(props) |
| 200 | this.version = version |
| 201 | |
| 202 | // To avoid undefined data at mount, pre-populated pending PromiseStates |
| 203 | // TODO: de-dupe with update code |
| 204 | const mappings = finalMapPropsToRequestsToProps(omitChildren(props)) || {} |
| 205 | const initDate = Object.keys(mappings).reduce((data, prop) => { |
| 206 | const mapping = mappings[prop] |
| 207 | if (Function.prototype.isPrototypeOf(mapping)) { |
| 208 | data[prop] = (...args) => { |
| 209 | this.refetchDataFromMappings(mapping(...args)) |
| 210 | } |
| 211 | } else { |
| 212 | data[prop] = PromiseState.create(mapping.meta) |
| 213 | } |
| 214 | return data |
| 215 | }, {}) |
| 216 | |
| 217 | this.state = { |
| 218 | mappings: {}, |
| 219 | startedAts: {}, |
| 220 | data: initDate, |
| 221 | refreshTimeouts: {} |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | componentDidMount() { |
| 226 | this.refetchDataFromProps() |
nothing calls this directly
no test coverage detected