We seem to have a race issue
On the 2.8 version of the editor, we have a strange issue :
This is a problem that I didn't get in local. For this reason, @sylvain suggest that it could be a race issue. So I've made a proposal to solve that.
Here it is the code in 2.8 version :
// On change we init the preview
cmBody.on("change", () => this.createPreview(resource, iframe, cmBody, cmHead));
cmHead.on("change", () => this.createPreview(resource, iframe, cmBody, cmHead));
// Init the preview
this.createPreview(resource, iframe, cmBody, cmHead)
And this is my proposal made on 2.10 version :
var setBody = new Promise(function(resolve, reject) {
cmBody.on("change", () => this.createPreview(resource, iframe, cmBody, cmHead));
});
var setHead = new Promise(function(resolve, reject) {
cmHead.on("change", () => this.createPreview(resource, iframe, cmBody, cmHead));
});
Promise.race([setBody, setHead]).then(function(value) {
this.createPreview(resource, iframe, cmBody, cmHead)
});
With this solution, we don't have the graphic bug but we're not able to get the rendering.
I ask for some help..
The piece of code I show here is the only thing that I've changed since I lost the render of my data.
Is anybody have a other proposal to made to solve the race issue on the 2.8 ?
Thank you very much!