fix: Make update banner refresh button robust
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
@@ -274,8 +274,14 @@ function App() {
|
||||
Client version mismatch, please refresh:{' '}
|
||||
<button onClick={() => {
|
||||
waitingWorker.postMessage({ type: 'SKIP_WAITING' });
|
||||
navigator.serviceWorker.addEventListener('controllerchange', () => {
|
||||
window.location.reload();
|
||||
const reload = () => window.location.reload();
|
||||
navigator.serviceWorker.addEventListener('controllerchange', reload, { once: true });
|
||||
|
||||
// Fallback for when the controller has already changed (ie. in another tab)
|
||||
navigator.serviceWorker.getRegistration().then(reg => {
|
||||
if (!reg || !reg.waiting) {
|
||||
reload();
|
||||
}
|
||||
});
|
||||
}}>
|
||||
Refresh
|
||||
|
||||
Reference in New Issue
Block a user