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

Add caching for components? #12

Open
must opened this issue Jan 25, 2021 · 3 comments
Open

Add caching for components? #12

must opened this issue Jan 25, 2021 · 3 comments
Assignees

Comments

@must
Copy link
Contributor

must commented Jan 25, 2021

How would we go about caching a list of articles that have been loaded when changing between pages.

@loreanvictor
Copy link
Contributor

I think the best method would be caching the corresponding backend functions. for example look at this.

@must
Copy link
Contributor Author

must commented Jan 25, 2021

How would this work for paginated data? So yes it will reload things from the cache (which can create some inconsistencies eventually and that's another topic) but reloading the component would default to the first n articles, wouldn't it? And the user will still have to scroll to reload (from the cache).

@loreanvictor
Copy link
Contributor

ok now I understand what you mean. well through navigation the old component is destroyed and a new instance is created. data that is displayed is an internal state of that component, stored inside its closure, which gets destroyed when the component is destroyed.

the only way around this would be for the component to store this state somewhere outside of its closure, so each new instance can pull it from there. localstorage for example would do, but perhaps for this purpose simply moving the state corresponding to loaded data outside of the component would suffice.

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

2 participants