Sencha Architect: Delete View, Model and Store Bug

Today working with Sencha Architect I discovered a bug when deleting a view and model. I assume it would also be the case when deleting a store. First, why don’t I report it to Sencha? They aren’t listening, nor do they appear to care. Not once since IDEA purchased Sencha have I seen any engineer anywhere around the forums. As for those who support the forums, well my opinion they are not to bright on their product or how forums should operate.

Reality is Sencha Architect auto-builds your Application.js file. Say you have an Application.js (metadata when in Sencha Architect) that looks like this

"models": {
    'myapp.model.person',
    'myapp.model.company',
    'myapp.model.product'
},
"views": {
    'myapp.view.Person',
    'myapp.view.Company',
    'myapp.view.Product'
},
"stores": {
    'myapp.store.person',
    'myapp.store.company',
    'myapp.store.product'
}

Now say you decide to delete myapp.model.product, myapp.veiw.Product and myapp.store.product from your project. Doing so will update your Application.js file to look like this

"models": {
    'myapp.model.person',
    'myapp.model.company',
    null
},
"views": {
    'myapp.view.Person',
    'myapp.view.Company',
   null
},
"stores": {
    'myapp.store.person',
    'myapp.store.company',
    null
}

Save your project and refresh your browser and you will get an error stating Cannot find .indexOf() null. Considering this file is auto-generated you’ve really no reason to look at you Application.js file. The building is a feature to streamline and speed up your application development. But this only works when it is working correctly. Here is what your Application.js file should look like after deleting those files.

"models": {
    'myapp.model.person',
    'myapp.model.company'
},
"views": {
    'myapp.view.Person',
    'myapp.view.Company'
},
"stores": {
    'myapp.store.person',
    'myapp.store.company'
}

Line removed, comma removed; just like the you would expect the file to look like.

Now since you CANNOT edit the Application.js metadata, and if you were to edit the Application.js JavaScript file it wouldn’t do any good because the next “save” would rebuild the actual JavaScript version. So there is another tip here, Sencha Architect works from metadata stored in JSON files. From those JSON files all JavaScript files are rebuilt with every save.

The only way to resolve this issue using Sencha Architect is exactly how you would think… Create another model, view and store and magically the “null” values are replaced by the new object definitions. Now this is all and good if you are still developing models, views and stores but if it is your part of your project cleanup process the only solution is to create “dummy” objects to replace the null values. So this is a major bug that is not being addressed. A bug we developers would never think of looking for especially based on the error of Cannot find .indexOf() null.

Author: aallord

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.