fix(tradein-fe): scraper-страница падала — scraper-settings {settings:[]} + string delay #872
No reviewers
Labels
No labels
admin
analytics
auth
automation
bug
business
chore
ci
compliance
data
data-moat
docs
duplicate
dx
enhancement
Fable 5 ревью
feedback/max
generative
GG-форсайт
needs-discussion
needs-human
observability
pause-bots
performance
priority/p0
priority/p1
priority/p2
priority/p3
scope/backend
scope/db
scope/devops
scope/frontend
scope/qa
scrapers
security
site-finder
stage/1
stage/2
status/blocked
status/done
status/needs-analysis
status/needs-fix
status/qa
status/ready
status/review
status/wip
tech-debt
tradein
ux
week ревью 1
wontfix
вторичка
ИРД
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lekss361/gendesign#872
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "fix/tradein-scraper-page-settings-shape"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Live-баг (Playwright на проде):
gendsgn.ru/trade-in/scrapers/cianпадала в error boundary «Что-то пошло не так» →TypeError: e.find is not a function. Auth/API при этом 200.Корень:
useScraperSettingsждалScraperSetting[], аGET /admin/scraper-settingsвозвращает обёртку{"settings":[...]}→data.find()/.map()/.lengthпадали. Вторично:request_delay_secприходит строкой"7.00"→.toFixed(1)бы упал.Фикс (frontend-only, без изменения API):
useScraperSettings: unwrapr.settings ?? []+ коэрцияrequest_delay_sec: Number(...)..toFixedчерез Number на PUT-ответе.scrapers/yandex/page.tsx(был тот же недо-unwrap без?? []/Number).scrapers/avito — не использует scraper-settings (не затронут), n1 нет. tsc --noEmit + lint чисто. 2 файла, +13/-3.
GET /api/v1/admin/scraper-settings возвращает {"settings":[...]} а не голый массив; request_delay_sec приходит строкой "7.00". Оба файла (cian, yandex) обновлены: unwrap r.settings ?? [] + Number() коэрция в queryFn; Number() защита на updateSettingMut.data.✅ APPROVE — live-fix: scraper-settings страница падала (
e.find is not a function).Оба корня подтверждены в backend:
/scraper-settingsвозвращает{"settings": [...]}(admin.py:968) — ровно тот wrapper, что фикс анврапит. Cian-страница ждала голый массив →.find/.map/.lengthпадали. Yandex-страница уже анврапила, но без?? []/Number. ✓request_delay_sec— PGnumeric(PUT:CAST(:d AS numeric), admin.py:994) → psycopg v3 сериализует numeric как строку JSON ("7.00") →.toFixed()бы упал.Number(...)коэрция корректна (и на GET-map, и на PUT-response guard). ✓?? []защищает от null/missing. Симметрично cian+yandex. TS strict:apiFetch<{settings: ScraperSetting[]}>+.map→ScraperSetting[]соответствуетuseQuery<ScraperSetting[]>. Frontend-only (без изменения API), avito не использует scraper-settings (не затронут), секретов/self-extending нет.Мержу. (Live frontend hotfix, без linked issue.)