Server: Assets werden nachgefragt statt jedes Mal neu geladen

Auf allem stand no-store -- im Server und noch einmal in preloadAssets().
Der Browser durfte also nichts behalten, und jeder Reload lud die vollen
Assets neu: 3 MB Screenshots, 3,3 MB Mockups, Schriften, Bibliotheken.

Am schlimmsten in uebersicht.html. Die laedt die sechs Projekte als
iframes, und weil keiner etwas behalten durfte, holte sich jeder iframe
dieselben Dateien noch einmal: 38,1 MB in 435 Anfragen.

  uebersicht.html erster Aufruf   38,1 MB  ->  2,2 MB
  uebersicht.html Reload          32,8 MB  ->  1,9 MB
  post6.html Reload                5,4 MB  ->  0,3 MB

Die Absicht hinter no-store war richtig: ein Bild, das unter demselben
Namen ausgetauscht wird, muss sofort ankommen. no-cache leistet das
billiger -- der Browser behaelt seine Kopie, fragt aber vor jeder
Benutzung nach. Nachgeprueft: unveraendert antwortet der Server mit 304
und 0 Bytes, nach einem touch mit 200 und der vollen Datei.

Seite, Stand und Auskuenfte (/bilder, /state) bleiben bei no-store. Die
sind klein und duerfen nie aus einer Kopie kommen.

Die eine Zeile stand in allen sieben Projektdateien.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U7RZ6ZpLD8Dp84Rtt4KHfv
This commit is contained in:
dejanandClaude Opus 5 committed 2026-08-29 16:31:25 +02:00
1 parent e8f5686f30
commit 77734b6da2
9 files changed
+111 -20

No files matched your search

+11 -2
View File
@@ -5001,8 +5001,17 @@ if (location.search.indexOf("nur=anim") >= 0)
// Optional: the layout falls back to a hint if the file is not there yet.
const optional = new Set(["./assets/mockups/laptop.png", "./assets/mockups/macbook-fels.png"]);
paths.push("./assets/mockups/laptop.png", "./assets/mockups/macbook-fels.png");
/* no-cache und nicht no-store: der Browser darf seine Kopie behalten,
muss aber vor jeder Benutzung nachfragen. Eine ausgetauschte Datei
kommt damit genauso sofort an wie vorher, eine unveraenderte kostet
ein 304 ohne Rumpf statt ihrer vollen Groesse.
Mit no-store lud jeder Reload rund 6 MB neu -- 3 MB Screenshots,
3,3 MB Mockups -- obwohl sich nichts davon geaendert hatte. Gemessen
an 61 Anfragen je Aufruf. Die Auskuenfte (/bilder) und der Stand
bleiben bei no-store: die sind klein und duerfen nie alt sein. */
for (const path of [...new Set(paths)]) {
const res = await fetch(path, { cache: "no-store" }).catch(() => null);
const res = await fetch(path, { cache: "no-cache" }).catch(() => null);
if (!res || !res.ok) {
if (optional.has(path)) continue;
throw new Error(path + " -> HTTP " + (res ? res.status : "kein Zugriff"));
@@ -5580,7 +5589,7 @@ if (location.search.indexOf("nur=anim") >= 0)
// Eine Datei einlesen, damit sie sofort im Canvas und im Export vorliegt.
async function bildBereitstellen(pfad) {
if (assets[pfad]) return true;
const res = await fetch(pfad, { cache: "no-store" }).catch(() => null);
const res = await fetch(pfad, { cache: "no-cache" }).catch(() => null);
if (!res || !res.ok) return false;
const blob = await res.blob();
assets[pfad] = await new Promise((ok, fail) => {