From 99f1a4a73335fbdb2bb4bf583b5e16bf259efea2 Mon Sep 17 00:00:00 2001 From: bot-backend Date: Sun, 26 Jul 2026 22:51:56 +0300 Subject: [PATCH] fix(tradein/v2): reset map CDN-error flag on retry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Без сброса ветка ошибки — тупик: она подменяет контейнер карты в дереве рендера, поэтому mapContainerRef остаётся null и повторная попытка не может удаться. Один сбой unpkg убивал карту до перезагрузки страницы, даже после выбора другого адреса. Найдено на pre-push ревью. --- .../frontend/src/components/trade-in/v2/ParamsPanel.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tradein-mvp/frontend/src/components/trade-in/v2/ParamsPanel.tsx b/tradein-mvp/frontend/src/components/trade-in/v2/ParamsPanel.tsx index 46d8e009..251e66e3 100644 --- a/tradein-mvp/frontend/src/components/trade-in/v2/ParamsPanel.tsx +++ b/tradein-mvp/frontend/src/components/trade-in/v2/ParamsPanel.tsx @@ -911,6 +911,13 @@ export default function ParamsPanel({ let map: any = null; let cancelled = false; + // Reset a previous CDN failure before retrying. Without this the error + // branch is a dead end: it replaces the map container in the render tree, + // so mapContainerRef stays null and no later attempt can ever succeed — + // one transient unpkg blip would kill the map for the rest of the session + // even after the user picks a different address. + setMapLoadError(false); + loadLeaflet() .then((L) => { if (cancelled || !mapContainerRef.current || !coordsRef.current) return;