We "preload" a few css theming variables that are needed before plugins have a chance to load. ThemeUtils.preloadTheme() first attempts to load the variables from the localStorage cache. If this fails, or if no cached variables exist, it falls back to calculatePreloadStyleContent() where default values for our variables are provided. This means that when variables exist in the cache, calculatePreloadStyleContent() won't be called before the initial page load. This is by design under normal circumstances, but in cases where we may update the list of preload variables, it means the user can experience a 1 time page load that is missing colors. This will resolve itself after first login but does introduce the possibility of a user experiencing missing colors on the login page immediately following a DHC update.
To see the issue, logout of DHE, run the following in dev tools, and refresh the page
localStorage.setItem('deephaven.themeCache', '{"themeKey":"default-dark","preloadStyleContent":":root{--dh-color-input-bg:#fff}"}')
Note that DHC is less impacted by this issue since plugins load before login, but a user may still se the loading spinner or background color be off on initial page load.
One fix that could mitigate this would be to always call calculatePreloadStyleContent() and then override variables that are in the cache. This would ensure we always get new variables. It would not handle a scenario where we change a default variable value, but that's probably ok since things will resolve after login.
We "preload" a few css theming variables that are needed before plugins have a chance to load.
ThemeUtils.preloadTheme()first attempts to load the variables from the localStorage cache. If this fails, or if no cached variables exist, it falls back tocalculatePreloadStyleContent()where default values for our variables are provided. This means that when variables exist in the cache,calculatePreloadStyleContent()won't be called before the initial page load. This is by design under normal circumstances, but in cases where we may update the list of preload variables, it means the user can experience a 1 time page load that is missing colors. This will resolve itself after first login but does introduce the possibility of a user experiencing missing colors on the login page immediately following a DHC update.To see the issue, logout of DHE, run the following in dev tools, and refresh the page
Note that DHC is less impacted by this issue since plugins load before login, but a user may still se the loading spinner or background color be off on initial page load.
One fix that could mitigate this would be to always call
calculatePreloadStyleContent()and then override variables that are in the cache. This would ensure we always get new variables. It would not handle a scenario where we change a default variable value, but that's probably ok since things will resolve after login.