Testing lifecycle of layer that performs async computation #5594
-
Hello, updateState({props, oldProps}) {
if (props.data !== oldProps.data) {
// compute new derived data, store in local state when done
computeDerivedData(props.data).then((derivedData) => this.setState({derivedData: derivedData});
}
}
renderLayers() {
return [
new SomeLayer(this.getSubLayerProps({
// use derived data from local state
data: this.state.derivedData
})
)
]
} This all works fine, but now I want to write (lifecycle) tests for these layers and I'm not sure how to best do this. If I use I also tried using I think a variation of |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Just implement your own get isLoaded() {
// return asyncComputationCompleted;
} |
Beta Was this translation helpful? Give feedback.
Just implement your own
isLoaded
: