Bug de rafraichissement de données

This commit is contained in:
2026-07-05 10:50:17 +02:00
parent 186ffc2596
commit 0d8f92bc9a
4 changed files with 52 additions and 3 deletions
+17
View File
@@ -25,6 +25,9 @@ function IconAide() {
function IconComm() {
return <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg>;
}
function IconRefresh() {
return <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><polyline points="23 4 23 10 17 10"/><polyline points="1 20 1 14 7 14"/><path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"/></svg>;
}
function IconChevronRight() {
return <svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M9 18l6-6-6-6"/></svg>;
}
@@ -192,6 +195,17 @@ export default function UserMenu() {
const go = (path) => { closeMenu(); navigate(path); };
const handleLogout = () => { closeMenu(); logout(); navigate('/login'); };
// En mode standalone (webapp ajoutée à l'écran d'accueil iPad), il n'y a
// ni bouton reload ni pull-to-refresh natif. On force donc une vraie
// navigation réseau (pas juste reload()) avec un paramètre anti-cache,
// pour être certain de récupérer l'index.html et les données à jour.
const handleForceRefresh = () => {
closeMenu();
const url = new URL(window.location.href);
url.searchParams.set('_r', Date.now().toString());
window.location.replace(url.toString());
};
const selectView = (v) => {
setActiveView(v);
closeMenu();
@@ -268,6 +282,9 @@ export default function UserMenu() {
<button className="user-menu-item" role="menuitem" onClick={() => go('/aide')}>
<IconAide /> Aide
</button>
<button className="user-menu-item" role="menuitem" onClick={handleForceRefresh}>
<IconRefresh /> Recharger l'application
</button>
<div className="user-menu-sep" />