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

feat: Allow resources to be cached #75

Closed

Conversation

oliversalzburg
Copy link
Collaborator

I feel like this was someone's intention all along. I just tied all the pieces together. When a new release is published yarn run build should be used to bump the revision. Then that is used to construct the cache-breaking URL query parameter. This way the client only need to pull the resources once for every version of KG.

I wasn't able to test this yet.

@hyx3179
Copy link

hyx3179 commented Jan 5, 2025

ServiceWorker may be a better solution. My own version uses this technology.
https://github.com/hyx3179/kittensgame/blob/fd2583d7d0210961ec88cc14f628470bcf1f30af/sw.js
https://github.com/hyx3179/kittensgame/blob/fd2583d7d0210961ec88cc14f628470bcf1f30af/index.html#L6
I'll sort out the relevant code when I have time.

@oliversalzburg
Copy link
Collaborator Author

Oh, fancy solution. Very nice.

I'd probably have to clean this PR up anyway, but it didn't seem like there was much interest to merge this 😄

@hyx3179
Copy link

hyx3179 commented Jan 6, 2025

Most of the client's demand for this feature comes from slow loading. It often takes more than 1 minute to load the official website where I am, and network errors often occur and the website cannot be loaded. 😂
If the server is charged by bandwidth, there may not be much demand for this feature.

I feel like this was someone's intention all along. I just tied all the pieces together. When a new release is published `yarn run build` should be used to bump the revision. Then that is used to construct the cache-breaking URL query parameter. This way the client only need to pull the resources once for every version of KG.
@oliversalzburg
Copy link
Collaborator Author

I restored the simple change on top of master. It's not great, but it's something.

@oliversalzburg
Copy link
Collaborator Author

@hyx3179 I agree, ServiceWorker seems like the all-around best solution. Maybe @bloodrizer wants to adopt that in the future, but I don't believe I can achieve much here. I'll close this in favor of a proper solution in the future.

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

Successfully merging this pull request may close these issues.

2 participants