We have an Application which was running perfectly in dev Mode. Today we tried to build the application and we recognized that there were "Requires" missing (errors while or after compiling). Adding the "Requires" brings a new problem which is about timings.
There is an extj class "enviroment (singleton)" which holds data and has multiple functions. One function get started by an controller which makes an ajax call (data gets set). The second function check for "permissions/roles".
Now while everything gets required, multiple stores, views ask the enviroment class for permission. Because the data is not set there are multiple errors.
Difficult to say without more information. In general, you obviously want to get that data loaded before trying to use it. Can you use events to control that or perhaps check for admin privileges before the store loads?