update cache
Build and Deploy Docker Images / build_and_deploy (push) Has been cancelled

This commit is contained in:
hamid zarghami
2026-07-08 10:37:41 +03:30
parent db15454a83
commit 9e70565748
@@ -158,19 +158,19 @@ export function PatternBackgroundProvider({ children }: { children: ReactNode })
cached.patternDataUrl;
if (cacheHit) {
// Serve cached pattern immediately, then revalidate in background.
setPatternImageUrl(cached.patternDataUrl!);
setThemeCache(restaurantSlug, {
...themeBase,
patternDataUrl: cached.patternDataUrl,
});
applyCachedThemeToDom(cached);
return;
}
let cancelled = false;
const proxyUrl = `/${restaurantSlug}/api/proxy-svg?url=${encodeURIComponent(themeBase.bgUrl)}`;
fetch(proxyUrl)
fetch(proxyUrl, { cache: "no-store" })
.then((response) => {
if (!response.ok) {
throw new Error("Failed to fetch background pattern");
@@ -181,7 +181,9 @@ export function PatternBackgroundProvider({ children }: { children: ReactNode })
if (cancelled) return;
const dataUrl = svgToDataUrl(colorizeSvg(svg, menuColor));
setPatternImageUrl(dataUrl);
if (dataUrl !== cached?.patternDataUrl) {
setPatternImageUrl(dataUrl);
}
const nextCache = {
...themeBase,