Dependencies not always loaded....
Quote:
Originally Posted by Sottilde
Quote:
Originally Posted by abcoa
Sottilde
First of all - great document...I really had tough time getting my Sencha Architect project working with my MS Visual Studio (it was all manual)
One question though...
How did you resolve managing dependencies that are not on the main application Viewport?
Let me elaborate...
I for example have a grid that only shows after clicking on the menu item after inital page loads in...Create JSB process picked up a grid component dependency somehow but missed grid columns (Number, etc, etc...)
Have you run into this? If so how did you solve it?
Only thing I can think of is to keep adding JS references to individual files to index-build.html...but that is going to get old pretty soon....
Interesting. I too have a number of dependencies similar to this but they all loaded correctly. I have a viewport that contains header, content, and footer containers. The content container is the real meat of the application, and it is simply a card layout. When I recently added a grid to my app the dependencies were added, but some of them appear to be resolved AFTER Ext.onLoad, which is why I added the 5000ms setTimeout to phantom-jsb.js.
You may be able to help your issue by adding requires[] or uses[] statements to files that are loaded before Ext.onReady. I solved some issues I had with History and Cookies modules by simply including a file that contains these requires statements, before I include app.js. You may have luck with this. If you simply require your app's views that are not being loaded properly, it should also load all its dependencies.
I suppose the only "correct" solution to this issue in the future may be for phantom-jsb.js to run a test case that runs though the app, then to grab the contents of Ext.Loader. But there are of course authentication and other issues with that. Otherwise, you may be stuck including just ext-all.js and your application files in the .jsb3, and letting JSBuilder minify that. But I suppose that's nothing more than you could get with any simple minification tool.
I have noticed several things (using ext-debug.js):
When I load my app via browser and initial viewport loads, a number of dependencies are loaded.
But then, when I navigate to a different view (in my case a new tab in central tabpanel is opened that has a grid) a slew of other dependencies are being loaded on demand. But I think this goes to tell that if phantomJS is looking up Loader.history to figure out dependencies and you provide only initial view then it will not know about other ones (it cannot navigate to this other view magically).
The solutions are (as you indicated)
- to either provide all these dependencies in index-build.html
- use requires statements (ughhh...)
Neither, in my opinion is maintainable :)
Then I started thinking about what you said regarding including ext-all.js...
For a fairly complex app, why not just combine app's code with it and minify everything.
If you can say that app is using 75% of the framework and you decide to include ext-all.js, you would be making a trade-off between headeaches of dependency management and having few extra bytes being downloaded by clients (I have not checked, but I think extra 25% of framework your app is not using would not add a lot of overhead)
I am really considering this approach, but there is now another culprit....
How do I generate JSB3 file with a target that has only my apps files (and none of ext js ones)....:)
If I can do this in some automated fasion that would be great....
Can phantom js task that reads Ext.Loader.history generate 2 targets by filtering Ext dependencies and your Apps dependencies (I think it could becuase you have to give your app the namespace)
Saga continues...