Aurelia-store with localStorageMiddleware does not call computed functions

We began using aurelia-store in our application about 4 months back and it has been fine and worked as intended. However we have run into a issue recently when our PO required that we save things to local storage. I struggled to use traditional local storage without using the localStorageMiddleware since the initialState would override what I had saved in storage. Eventually I went with localStorageMiddleware and things appeared to be working fine until we noticed an issue where some of our @computed data was not being bound to the view. We discovered that when we have something in localStorage, the middleware deserializes the JSON that dispatches our store functions. However, we have some computed properties that are not a part of our state object and are not getting called as a result. If we clear localStorage and reload the application the computed properties are calculated as we expect. Is there a workaround for this?

1 Like

Could you help with some pseudo code so the issue can be visualized easier?

2 Likes