Compare commits

...

2 Commits

Author SHA1 Message Date
min
91d3f48b80 fix(wiki): cache-buster �� ��������� ���� (#27)
All checks were successful
CI / Lint (push) Successful in 1m10s
CI / Build (push) Successful in 2m0s
CI / Secret scan (push) Successful in 2m34s
CI / PR size check (push) Has been skipped
CI / Deploy to S1 + S2 (push) Successful in 2m52s
2026-06-03 04:41:18 +00:00
min
b7e3620a21 fix(wiki): cache-buster ?v на картинках вики (битый SPA-fallback в кэше)
All checks were successful
CI / Lint (pull_request) Successful in 1m9s
CI / Build (pull_request) Successful in 2m3s
CI / Secret scan (pull_request) Successful in 2m36s
CI / PR size check (pull_request) Successful in 8s
CI / Deploy to S1 + S2 (pull_request) Has been skipped
У юзеров, открывавших статью/карточку ДО заливки PNG в build/wiki/,
браузер кэшировал SPA-fallback (HTML index.html вместо картинки) и
Ctrl+Shift+R не помогал (инцидент с guide-taxisim). Добавлен версионный
?v=N ко всем wiki-URL (Shot + карточки) — новый URL обходит битый кэш.
Бампать WIKI_ASSET_V при добавлении новых картинок.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-03 07:21:52 +03:00
2 changed files with 12 additions and 3 deletions

View File

@ -8,7 +8,7 @@ import RublocsLogo from '../components/RublocsLogo/RublocsLogo';
import useDeviceType from '../hooks/useDeviceType'; import useDeviceType from '../hooks/useDeviceType';
import KubikonDesktopOnlyStub from './KubikonDesktopOnlyStub'; import KubikonDesktopOnlyStub from './KubikonDesktopOnlyStub';
import Icon from '../editor/Icon'; import Icon from '../editor/Icon';
import { DOCS } from './docsData'; import { DOCS, wikiUrl } from './docsData';
import { GAMES, GAME_GROUPS } from './docsGames'; import { GAMES, GAME_GROUPS } from './docsGames';
import { LESSONS, hasLesson } from './docsLessons'; import { LESSONS, hasLesson } from './docsLessons';
import { buildGameProject } from './docsGamesBuilders'; import { buildGameProject } from './docsGamesBuilders';
@ -233,7 +233,7 @@ const GamesGrid = ({ onOpenLesson }) => (
</div> </div>
<img <img
className="gameCard__img" className="gameCard__img"
src={`/wiki/${g.previewShot || `lesson${g.num}-result.png`}`} src={wikiUrl(g.previewShot || `lesson${g.num}-result.png`)}
alt={g.title} alt={g.title}
loading="lazy" loading="lazy"
onError={(e) => { e.currentTarget.style.display = 'none'; }} onError={(e) => { e.currentTarget.style.display = 'none'; }}

View File

@ -82,11 +82,20 @@ export const Try = ({ children }) => (
); );
// Скриншот интерфейса с подписью // Скриншот интерфейса с подписью
// Версия вики-ассетов (cache-buster). Бампать при добавлении/замене картинок
// в public/wiki/ иначе у юзеров, открывавших статью ДО заливки файла,
// браузер кэширует битый SPA-fallback (HTML вместо PNG) и Ctrl+Shift+R не
// помогает (инцидент 2026-06-03 с guide-taxisim). Новый ?v=N = новый URL.
export const WIKI_ASSET_V = 4;
/** URL вики-картинки с версией для обхода кэша. */
export const wikiUrl = (name) => `/wiki/${name}?v=${WIKI_ASSET_V}`;
// src имя файла из public/wiki/, caption подпись под картинкой. // src имя файла из public/wiki/, caption подпись под картинкой.
// wide для широких скринов (обзор, лента): растянуть на всю ширину. // wide для широких скринов (обзор, лента): растянуть на всю ширину.
export const Shot = ({ src, caption, wide }) => ( export const Shot = ({ src, caption, wide }) => (
<figure className={'docShot' + (wide ? ' docShot--wide' : '')}> <figure className={'docShot' + (wide ? ' docShot--wide' : '')}>
<img src={`/wiki/${src}`} alt={caption || ''} loading="lazy" /> <img src={wikiUrl(src)} alt={caption || ''} loading="lazy" />
{caption && <figcaption>{caption}</figcaption>} {caption && <figcaption>{caption}</figcaption>}
</figure> </figure>
); );