Commit c0cca70b authored by vertighel's avatar vertighel
Browse files

fits-viewer.js: bust della cache <img> per /png e /panoramic

Con dinamica manuale (autoRange=false) vmin/vmax restano fissi tra un
frame e l'altro, quindi l'URL di /png e /panoramic era identico a ogni
richiesta (prima variava leggermente con l'auto-range del server).
_loadImage() usa new Image()/src, e alcuni browser continuano a servire
il bitmap gia' decodificato per un URL identico anche con
Cache-Control: no-store sulla risposta — a differenza del magnifier,
che usa fetch/WebSocket per i dati raw e rispetta correttamente
l'header. Risultato: dopo la prima modifica manuale della dinamica,
l'immagine principale restava bloccata sull'ultimo frame.

Aggiunto `_: seq` come parametro di query (il numero di sequenza,
gia' univoco e monotono) cosi' ogni richiesta ha un URL diverso e
forza sempre un fetch reale.
parent d7eaa6c8
Loading
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -516,7 +516,11 @@ export class FitsViewer {
        const canvas = this._el.canvasMain;
        const url    = this._url(
            `/viewer/${state.cam}/png`,
            { vmin: state.vmin, vmax: state.vmax }
            // `_: seq` busts the browser's <img> cache: when vmin/vmax are
            // pinned (manual range), the URL would otherwise be byte-identical
            // across frames and some browsers keep serving the same cached
            // decoded image even with Cache-Control: no-store on the response.
            { vmin: state.vmin, vmax: state.vmax, _: seq }
        );

        const img = await this._loadImage(url);
@@ -593,7 +597,9 @@ export class FitsViewer {
        const state = this._primary;
        const url   = this._url(
            `/viewer/${state.cam}/panoramic`,
            { vmin: state.vmin, vmax: state.vmax, max_px: THUMB_PX }
            // See _renderPng: `_: seq` busts the <img> cache when vmin/vmax
            // (and therefore the URL) stay pinned across frames.
            { vmin: state.vmin, vmax: state.vmax, max_px: THUMB_PX, _: seq }
        );

        try {