fix(sf-fe): decode cad param (B5 400) + hide entry sidebar when drawer open #351
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
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lekss361/gendesign#351
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "fix/sf-cad-decode-drawer-overlay-v2"
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?
Recreated from #350 (closed — branched off stale
fix/sf-entry-parcel-adapter-cadinputHEAD before #349 merged squash → conflict). This branch is rebased onto currentmain(f87a352after #349 merge), single commit.Summary
2 prod регрессии (user screenshot):
Bug A —
/parcels/{cad}/analyzeвсегда 400Next.js dynamic route доставляет
params.cadURL-encoded (:→%3A). Хуки потом делалиencodeURIComponentна уже-encoded строке →/api/v1/parcels/66%253A41%253A0204016%253A10/analyze. FastAPI decoded one layer →66%3A41%3A0204016%3A10, regex rejected → 400. Section 1 вечный error state.Fix:
decodeURIComponent(cadRaw)один раз на границе page → downstream хуки / breadcrumb / Section1 видят canonical66:41:0204016:10и encode ровно один раз при build URL. Заодно закрывает breadcrumb double-encode bug из QA PR #346.Bug B — sidebar и drawer наложены
При click на парцель
<ParcelDrawer/>slide-in из правого края наезжал на правый sidebar (CadInput + RecentParcels + ParcelLegend) — оба anchored right.Fix: conditional render — sidebar mounts только когда
selectedParcel == null.Verify post-deploy
/site-finder/analysis/66:41:0204016:10— Section 1 НЕ показывает «не удалось загрузить»; KPI + EGRN + POI рендерятся.GET /api/v1/parcels/66%3A41%3A0204016%3A10/analyze→ 200 (single-encode)./site-finder→ click на marker → drawer открыт, sidebar исчез; close → sidebar возвращается.66:41:0204016:10, не66%3A41%3A0204016%3A10.Closes #350.
Two prod issues: 1. Analysis page B5 endpoint returned HTTP 400 'Неверный формат кадастрового номера' for any cad. Next.js dynamic route delivers `params.cad` URL-encoded (':' -> '%3A'). Hooks then ran encodeURIComponent on the already-encoded string, producing /api/v1/parcels/66%253A41%253A0204016%253A10/analyze; FastAPI decoded one layer to '66%3A41%3A0204016%3A10', which the regex rejected. Fix: decodeURIComponent the param once at the page boundary so downstream consumers (hooks + breadcrumb + Section1) work with the canonical '66:41:0204016:10' and encode exactly once when building URLs. Also resolves the breadcrumb double- encode noted in PR #346 QA. 2. Entry page right-sidebar (CadInput + RecentParcels + ParcelLegend) visually overlapped the ParcelDrawer slide-in: both were anchored to the right edge with the drawer rendered above as an overlay without an opaque backdrop on the sidebar area. Conditional render: sidebar only mounts when no parcel is selected, so opening a parcel gives the drawer a clean right column.Deep Code Review — verdict APPROVE
Files reviewed: 2 (P2) · +25/-18 · mergeable=true · base=main@f87a3522
Bug A — decodeURIComponent at page boundary
decodeURIComponent(cadRaw)once on params; downstream hooks/breadcrumb/Section1 receive canonical66:41:0204016:10and re-encode exactly once when building API URL. Symmetric, correct fix.66:41:0204016:10is no-op (no%chars) — safe under any nav order.%XXwould throwURIError— acceptable, Next.js router won't deliver malformed segments; synthetic edge case falls back to app error boundary. Not worth try/catch.Bug B — conditional sidebar render
{selectedParcel == null && <Sidebar/>}cleanly hides right rail while drawer is open. No more overlap.CadInputlocal input state resets on remount,RecentParcelsre-mounts but TanStack Query cache survives → no refetch cost. UX-acceptable.Conventions
any, no XSS surface,== nullconsistent with surrounding code.Verify post-deploy (from PR body)
GET /api/v1/parcels/66%3A41%3A0204016%3A10/analyze→ 200/site-findermarker click → drawer open, sidebar hidden; close → sidebar back66:41:0204016:10Merging via squash.
Closing — superseded by ongoing UI alignment PR (frontend-engineer worker
a5cc7a063e4c5b18e). User feedback: sidebar hide approach из #351 неверное решение («при выборе ... закрывается блок Анализировать»). Новый PR: drawer positioned over map area only, sidebar (CadInput + Recent + Legend) всегда visible + decode cad сохраняется + UI alignment с макетом.