mardi 30 décembre 2014

Weird assignment failure in AbstractComponent

This is a real weird issue to me. I have a workaround but like to get insights of the cause.

The problem: my app shows a form panel from a list when a list item is tapped. The form panel sometimes will not show in iPhone. It shows fine in iPad, Android Phone/tablets. The app is hosted in a web server and accessed through the default browser of the devices above. Sencha Touch 2.4.1 commercial is used.


The root cause: took a while to identify the failure being at AbstractComponent.initElement line 117 to 119 (below). "element" is an object and "this.innerElement" is null so the assignment inside "if" was executed. The logs (by "console.log") showed that the assignment failed. After the assignment, "this.innerElement" is still null.

if (!this.innerElement) {

this.innerElement = element;

}


The workaround: assign "this.innerElement" to null or a string, then do the "element" assignment caused "this.innerElement" to be set.

this.innerElement=null; //or "aa"

this.innerElement=element;


The curiocity: Has anyone run into issues like this? It is totally weird. I wonder if it implies hidden serious issues.






Weird assignment failure in AbstractComponent

Aucun commentaire:

Enregistrer un commentaire