react-toggle icon indicating copy to clipboard operation
react-toggle copied to clipboard

Checked status not updating on state change through xmlhttprequest listener

Open kaushalvivek opened this issue 5 years ago • 0 comments

checkDeploymentStatus(modelId) {
   var xhr = new XMLHttpRequest()
   xhr.addEventListener('load', () => {
     if (xhr.responseText ==="deployed") {
       this.setState({
         isModelDeployed: true,
         modelInferenceAPI: MODEL_INFERENCE_API+'/'+this.props.modelVersion.run_id,
       });
     }
     else {
       this.setState({
         isModelDeployed: false,
         modelInferenceAPI: "Nor Deployed",
       });
     }
   });
   xhr.open('GET',MODEL_DEPLOYMENT_URL+"?runId="+modelId)
   xhr.send()
 }

This would update the state, but the state would not be reflected in the toggle.

kaushalvivek avatar Sep 25 '20 14:09 kaushalvivek