-
Notifications
You must be signed in to change notification settings - Fork 914
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
theme not loaded after page refresh in development mode #34
Comments
Hmm, interesting. Can you see theme configuration in local storage for lolcalgost when in dev mode? I only remember how to check it in Chrome, the dev tools application tab. |
I did some testing and it seems to be working in Chrome but not in Firefox and IE. Will look into why later... |
i have attached a screenshot for Chrome and IE11. the setting gets stored but on initial load not restored. even on settings page the stored theme gets not preselected. i don't know if this is an issue of your repo but i am a fan of it because it shows a lot of great studd. i tried reading: Initial State and Ahead of Time (AoT) Compilation but didn't get the clue. |
okay. just observed on your PROD site: It is working if ANMS-AUTH key is present. If you delete this key then it is not working. |
@tomastrajan i thought it would be an easy fix. But actually i don't get it. |
@enterprisebug yeah it should be related to the way we're initializing ngrx store on app startup, its looking for the keys per reducer / feature and probably this fails if the key (in our case ANMS-AUTH) is not present and probably the exception is swallowed silently. I am currently camping in Tasmania so not much internet or electricity is available but try checking / debugging local storage service in core module. Also, thank you very much for looking into this, I appretiate it a lot! |
So the problem is in the local storage service. This fails when the key is not found in local storage so we have to skip JSON parse in those cases. |
I was not able to find any swallowed exceptions... Loading the initial state seems to work in my opinion:
come back to a place where you have internet connection and electricity :-) |
strange. even after commenting the selectorAuth
|
Can you see theme class applied correctly in HTML like |
Ok I found out what the problem was. The initial state was retrieved correctly. Only auth reducer is available during init phase (other 2 are lazy loaded) so when we reduce initial state without Solution is to load and merge initial state on both |
- prevent loss of initial state of lazy loaded reducers - use meta reducer to merge local-storage state on both INIT and UPDATE (reducers) events - add debug meta reducer in DEV mode - run tests with PROD env to prevent debug reducer logging - standardize payloads (always use payload object with typed properties) Fixes #3, #34
@tomastrajan perfect! I'm really glad you found a solution! |
Hi,
after selecting e.g. the LIGHT-THEME on your published website the theme gets restored when refreshing the page. That is what is expected...
When cloning your rep the theme gets not restored in development mode after refreshing the page with F5.
I tried debugging for quite a while but couldn't find any solution.
Do you have a fix for that?
Thanks,
Daniel
The text was updated successfully, but these errors were encountered: