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

make cache work as expected #339

Open
kkuepper opened this issue Mar 4, 2024 · 4 comments
Open

make cache work as expected #339

kkuepper opened this issue Mar 4, 2024 · 4 comments
Labels
nice to have Has a low priority. Feel free to pick it up and solve it when it bugs you.

Comments

@kkuepper
Copy link
Member

kkuepper commented Mar 4, 2024

when navigating from the homescreen to somewhere else (e.g. a playlist) and then going back, I expect the homescreen to be cached and visible instantly.
Instead it needs to wait for the response from the server.
(Note: the response from the server is currently too slow and will be improved as well)

@sifferhans
Copy link
Collaborator

We could try to use the getCachedData option in useAsyncData composables.
https://nuxt.com/docs/api/composables/use-async-data#params

@SimonSimCity
Copy link
Collaborator

Ok, so tell me please, what is expected?

Currently our API implementation works with promises. A promise returns once. When implementing caching on this implementation, we'll have to choose whether to deliver an maybe outdated result (the cached one) or let the user wait a little longer; we cannot "deliver once (the cached response, or just the servers response if there's nothing cached) and maybe twice (in case we have a cached value and the server has an updated response)".

Continuing this way, we'll have to choose if and when we will send a request to the server despite having a cached value. Let's make it easy and say that we want to agree on one TTL for cached values, not a different one per URI. Another question here would be if the user can force-reload the content, and how.

Another approach would be to follow what Angular has been doing, to use pipelines (like RxJS), which can return multiple times. It uses this to both return the cached value immediately but also to send a request to the server. The only question remaining is then: How do we want to notify the user if the cached content he is already presented with, is outdated? Some apps show a notification, others just replace the content, which might be perceived as being unstable, if the user doesn't expect the content to change without his interaction (like in a collaborative environment).

Just this... we could show a notification somewhere generally if a response is outdated and the server has a newer response, but to me it's questionable whether we want that.

Just this: The question of how it should be for the user should guide the technical decision of how to realize this, not vv. We can always start small and grow, but we shouldn't start crippled, because we don't want to invest some time to outline where we want to be.

@kkuepper
Copy link
Member Author

kkuepper commented Apr 2, 2024

I think for now, I wouldn't cache anything. Most people use it on their PC with good internet connections. Therefore our efforts are better spent in other areas.

@kkuepper kkuepper added the nice to have Has a low priority. Feel free to pick it up and solve it when it bugs you. label Apr 2, 2024
@SimonSimCity
Copy link
Collaborator

SimonSimCity commented Apr 2, 2024

One of the reasons we've had caching in mind was the idea of allowing people from places with low bandwidth (e.g. Africa) to have a good experience when using the website/desktop app. We will have to see what other solutions they propose (e.g. Setting up an nginx-caching on a raspberry pi). Some of the solutions do not require us to prepare anything special, so I agree with having this ticket being on hold until this is talked about, after which we will reevaluate the priority.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
nice to have Has a low priority. Feel free to pick it up and solve it when it bugs you.
Projects
None yet
Development

No branches or pull requests

3 participants