Cleans up viewstate loading at startup

This is a fix for #6944. This change does a couple of things:

1. user-level viewstate is loaded *before* HTML rendering. This simulates the synchronous nature of localStorage in the old viewstate implementation
2. preference changes are queued up until `appReady` fires. This prevents a problem caused by the first change in which code attempts to update the status bar before the status bar is ready.