ngrx-store-localstorage icon indicating copy to clipboard operation
ngrx-store-localstorage copied to clipboard

Data not stored in LocalStorage

Open whtrbit opened this issue 7 years ago • 2 comments

Hi all, I have a problem with syncing the store in LocalStorage. First of all I have to mention that it is not a standard client-side Angular application. My app uses PHP server side rendering and Angular as modules that are lazy loaded. We use multi-page embedding strategy described here: https://blog.novatec-gmbh.de/angular-2-in-a-multi-page-application/

So the main PHP routing is done without hashes and when Angular does ngDoBootstrap hash is added to the URL and Angular module is lazy loaded.

My dev env is pure Angular app and syncing works perfectly fine. The problem occurs only with hybrid of PHP and Angular app.

I've also done a test with raw saving in LS -> window.localStorage.setItem('xxx', 'xxx'); and it also works just fine.

I'd be appreciate for any clues for that matter, with regards, Grzegorz.

whtrbit avatar Oct 29 '18 13:10 whtrbit

I may have figured this out, try removing aot and build optimizer from your angular.json. I am not sure why it does not work with those options but it was giving me a headache and as soon as users refreshed the app, my state was gone.

prog-24 avatar Sep 07 '20 08:09 prog-24

The deal is to make it work with AOT.

whtrbit avatar Nov 27 '20 15:11 whtrbit