fix(qlik): auto-refresh grid after sync without manual reload

Restore the _refresh searchParam bump so grid-client refetches
/api/grid/rows with refresh=1 (forceRefresh, bypassing the 10-min
getProductRows cache) and re-renders the network columns from the
store. Also call router.refresh() to update the server-rendered
MAJ Qlik timestamp on the button.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
MichaelandClaude Opus 4.8 committed 2026-06-21 08:23:34 +02:00
1 parent d54c3ae520
commit 0b9846f55d
1 file changed
+3 -1
@@ -43,10 +43,12 @@ export function SyncQlikButton({ codeFournisseur, lastUpdate }: SyncQlikButtonPr
if (!res.ok || !data.success) throw new Error(data.error || `HTTP ${res.status}`);
setStatus("success");
setMessage(`${data.upserted} produits réseau synchronisés`);
// Recharge la grille pour afficher les nouvelles données réseau
// Bump _refresh → grid-client refetch /api/grid/rows avec refresh=1 (forceRefresh,
// bypass cache 10 min de getProductRows) pour afficher les nouvelles métriques réseau.
const params = new URLSearchParams(searchParams.toString());
params.set("_refresh", String(Date.now()));
router.replace(`${pathname}?${params.toString()}`);
router.refresh();
setTimeout(() => setStatus("idle"), 4000);
} catch (e) {
setStatus("error");