Refreshing Stale UI After Deployment - Seeking Insights
Hey everyone :)
After deploying updates via vercel, I assume some users, still on the site without refreshing, interact with a stale UI. They encounter errors, like clicking on UI elements tied to endpoints that no longer exist.
How do you ensure your users always interact with an up-to-date UI, even if they haven't refreshed their browser? I assume this is not done by vercel, or next.js, or react itself, is it?
I thought maybe somehow asking users to refresh their browser or so might be good, are there some tools or libraries for this? I was searching through the web to find some solutions but could not find any yet, do you know some resources on this topic?
Looking forward to hearing your experiences and solutions.
Thanks for helping me out! :)
4 Replies
You could handle those old endpoints more gracefully than just removing them. If there's a 1:1 replacement, call the new endpoint from the old. If not, you could throw an error message or something similar that explains what the issue is to the user and suggests refreshing the page to resolve it. Then, once you're sure there are no users with stale UI, you can remove the old endpoint.
Additional shower thought: this is the sort of problem that can be solved with API versioning. Let the old client continue calling api/v1/endpoint1, while the new client calls api/v2/endpoint2
Thanks for answering. I also had kind of the same thoughts. I was just wondering if there are more simple solutions out there, because it seems kind of wasteful to add this kind of complexity (maintaining endpoints, etc) just to make the user refresh the page once. Feels like there should be some simpler solution to this 🤔
I'm not aware of any out-of-the-box solutions to this, but if you wanted to spend the time, you could use websockets to "push" a notification to end users whenever there's an update. Wouldn't take a ton of effort, afaik.
Hm, yeah. I will continue thinking about it, thanks for the input :)
I will keep this open, maybe someone might have something to say. If not, then I will mark your answer as the solution