Skip to content
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

Change not detecting #56

Open
lekhnath opened this issue Aug 6, 2016 · 5 comments
Open

Change not detecting #56

lekhnath opened this issue Aug 6, 2016 · 5 comments

Comments

@lekhnath
Copy link

lekhnath commented Aug 6, 2016

while changing class property decorated with @sessionStorage() the value stored in SessionStorage indeed changes, but the change is not reflected in decorated property elsewhere in the application. I need to manually refresh to whole browser to restore the value from SessionStorage in decorated property.

@marcj
Copy link
Owner

marcj commented Aug 7, 2016

elsewhere in the application what do you mean with that? The change detection is only one way: application to storage. We can not detect whether sessionStorage has changed nor want to.

@lekhnath
Copy link
Author

lekhnath commented Aug 7, 2016

By elsewhere in the application, I mean some other components than one that changes the local storage value.
Even though the storage value changes after assigning decorated property a new value I am not able to use that recently changed value elsewhere(it is the same elsewhere as above) without refreshing the page. How can I reflect the changes without having to refresh the whole page?

What does this mean? (from README)
// register LocalStorage, this registers our change-detection. LocalStorageSubscriber(appPromise);

I assumed that whenever the storage value gets change it automatically changes all the decorated property. What do you suggest to achieve such thing??

@inmodify
Copy link

I'm seeing the same thing.

For example. I have lists on 3 separate pages--different data. When I start the app initially and go back and forth between the first two lists they never cache and reload from localstorage. If I hit refresh, they do load the cached data. But if I then navigate between the three lists, only the first two load from localStorage. The third one does not unless I refresh the page again after having opened.

@lekhnath Did you have any luck with this?

@marcj I understand you're probably really busy(thus trying to get someone else to maintain.) Any insight would help--I'm going to try to troubleshoot it myself. I'll post something If I find out a workaround.

@lekhnath
Copy link
Author

@inmodify No, this issue still exists to me.
It seems it populates decorated property with LocalStorage value only on initial page reload. It is our job to maintain the changes across the application may be using services. So why not using services only then? That's why I stopped using this repo and created services to manipulate localStorage and sessionStorage. And because, I am using services the change are reflected as they happen.

@inmodify
Copy link

@lekhnath I can solve the issue by moving all of my services to the global or app level, thank you. That seems like a bad practice, but I think you're right--that would solve my problem, both ways, technically. I may dig back into this, after my deadline, we did this in the durandal world using a knockout extension that wrapped localForage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants