I use the fetch api to update partials with an html response. This is working in some actions but not others and I can’t figure out why. In the following code all the console.log print the expected output except for the final one:
fetch(url)
.then(response => response.json())
.then(json => {
console.log("available actions:", this.availableActionsTarget.innerHTML);
console.log("json response", json.available_actions_form.template);
this.availableActionsTarget.innnerHTML = json.available_actions_form.template;
console.log("available actions after re:", this.availableActionsTarget.innerHTML);
});
In other functions in my stimulus controller the innerHTML get assigned as expected but for some reason this one does not assign the innerHTML to the response.