The problem you are facing is probably caused by prerender. JSinteroop is not accesbile while prerendering the page thus, protectedLocalStorage is null because it relies on JS.
I always disable prerendering so I do not need to deal with it. It' s annoying so it's best to split your app into 2 part. The one for not logged users (promo page/ contact page etc.) and actual app that needs your state.
On the other hand you could implement your own logic for error handling and dealing with preload.