Cache busting not working, what am I missing?
I started by choosing a Vite + AntD config on refine.dev, and downloading the package. I created my app, and everything works great, except that users still need to refresh the browser to see the latest version of a page that I changed.
My hosting is on Netlify. Can anyone please walk me through what needs to be done to get cache busting to work properly in a Refine app? I have tried AI and my own ideas for days. Still can't get it working. Thanks in advance!
2 Replies
Hi @Adam Cz. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Based on the knowledge sources, this issue is related to browser caching of static assets when deploying new versions of your Refine application.
According to the information provided, Refine itself doesn't handle cache busting directly. As mentioned in a GitHub issue response:
This topic falls outside of Refine's concerns. Refine doesn't require any additional steps for the build process of the application and doesn't interfere with the build step of the platforms. Preventing the caching of assets is related with the production builds and how this steps generates assets.GitHub Issue #5383 Since you're using Vite with your Refine application, Vite should handle cache busting automatically in production builds by adding hashes to filenames. This is standard behavior for Vite, Next.js, and Remix - all platforms supported by Refine. For your specific case with Netlify hosting, you might want to: 1. Make sure you're building your application in production mode (
npm run build
or equivalent)
2. Check your Vite configuration to ensure it's generating hashed filenames for production builds
3. Verify that Netlify is serving the correct files and not caching them at the CDN level
If you're still experiencing issues, it might be related to Netlify's caching configuration rather than Refine or Vite. You could try adding cache control headers to your Netlify configuration.
This appears to be a deployment/build configuration issue rather than a Refine-specific problem, as Refine delegates these concerns to the underlying build platform (Vite in your case).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1326146812440215613> Kapa.ai is still learning and improving, please let me know how I did by reacting below.