1

I am building an ExtJS4 application using PHP and SQL for the user data. Everything was going fine until one day, I notice this error in my Java console:

Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. 
For more help, check http://xhr.spec.whatwg.org/.

Initially, I wasn't that troubled since my application was loading fairly well while testing it in my local network. However, once I uploaded to an online server and tested it, the application loaded really slowly and sometimes it wouldn't load at all.

I don't recall calling an XMLHttpRequest anywhere in my application, so I'm dumbfounded on how or why I'm getting this warning all of a sudden.

The only way I connect to my database and back is via Stores.

Also, as a side question, is there a way to make ExtJS4 applications load faster? I've minimized the size of the images/icons I use and I think the issue lies with the stores but none of my stores are set on autoload.

halfer
  • 19,824
  • 17
  • 99
  • 186
Razgriz
  • 7,179
  • 17
  • 78
  • 150

2 Answers2

3

I had this error a while a ago. It is caused by Ext.Loader which loads the Ext classes dynamically.

I could solve it by adding the required classes in the Ext.require([...]) statement in the main js file of my application (i.e. app.js).

The docs for Ext.Loader explain when and why asynchronous and synchronous loading happens.

gus27
  • 2,616
  • 1
  • 21
  • 25
  • What are the required files, Can you name some, I am getting the same? – Shrey Mar 19 '15 at 07:09
  • @Shrey: The required files are the files for the classes you are using in app.js. E.g. if you are using something like `Ext.getStore('my.store.SomeStore').load();` in the `launch()` function you should put a `requires: ['my.store.SomeStore']` in the Ext.application() function. – gus27 Mar 22 '15 at 10:22
  • @Shrey: ...and of course you'll have to insert the classes you used as `xtype`, too – gus27 Mar 22 '15 at 13:46
0

Not sure about the main question, never seen that before with extjs 4 apps I have written.

For the question in loading the application faster you should be using sencha CMD to produce a concatenated and minified version of your source for using in a production environment.

Edit

I just came across this SO - "Synchronous XMLHttpRequest on the main thread is deprecated" using nodejs app.get or http-server

Talks about the same issue but with a different framework and comments suggests its an error on client side. Have you changed much lately with how your are fetching data from the server?

Community
  • 1
  • 1
mindparse
  • 6,115
  • 27
  • 90
  • 191
  • I'm having a hard time publishing my web application, using Sencha Architect 3, but that's for a different question. – Razgriz Feb 15 '15 at 14:26
  • Ok well you should just be able to issue the build command straight from the command line and so bypass using architect. I had problems with architect 2 and so did it that way. All them separate files loading in the browser on first load will make it slow for sure – mindparse Feb 15 '15 at 15:29
  • Alright I'll look into building the web app from the my terminal. – Razgriz Feb 15 '15 at 16:03
  • Should just be a matter of issuing 'sencha app build production' from your command prompt if I recall – mindparse Feb 15 '15 at 16:07
  • I'm getting the `Mixed-Mode x-compile and microload markup is currently unsupported` and editing my app.json file does not help. See my question here http://stackoverflow.com/questions/28528666/sencha-cmd-build-error-mixed-mode-x-compile-and-microload-markup-is-currently – Razgriz Feb 15 '15 at 17:31