fix: unbreak main — Navbar useEffect, duplicate stepRef, and the SkeletonBar prop typing that reds every deploy preview - #492
Conversation
✅ Deploy Preview for smart-drop ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for spiffy-melomakarona-eb1e8a ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Confirmation that these two fixes unblock the E2E suite, not just the build: Before: The third breakage is still there and still blocks a production build: |
|
One more piece of evidence, from the checks on this PR: every status here is a Netlify deploy preview, and all of them fail — |
9f1790c to
0a6ef91
Compare
|
Ran the real build locally on the branch, since this is what the deploy previews run:\n\n |
|
Added one more commit: a lockfile sync that is not about this PR's own subject, but is the reason every Netlify check on this PR was red.
That is why the six checks on this PR ("Header rules", "Pages changed", "Redirect rules" — the two deploy previews each report three) were failing: they report the preview failing to build, and the preview cannot build while the install is refused. It is repo-wide, not specific to this branch. The commit adds The dependency is real, not stale: This commit is also on the other three open PRs from the same base (#490, #491, #493) so their previews can go green independently of this one merging. |
`pnpm build` fails before it compiles anything: ./src/hooks/useLockFlow.ts Module parse failed: Identifier 'stepRef' has already been declared (31:10) The hook declares it twice -- once in the shared "use refs to avoid recreating execute" block, and again six lines later under the SmartDropLabs#396 comment: 51 const stepRef = useRef(step); 52 stepRef.current = step; ... 61 const stepRef = useRef(step); <- the duplicate, with the rationale above it 62 stepRef.current = step; Same merge window as the missing `useEffect` import in the previous commit, and the same effect: `/farm` cannot compile, so the dev server serves a build-error overlay and its E2E specs time out looking for a Connect button that never renders. Kept the second declaration, because the SmartDropLabs#396 comment explaining why the ref exists belongs next to it, and deleted the first pair. The comment above the surviving `walletApiRef` said "when step or walletApi change"; with `stepRef` no longer there it says what it now means. Verification: the module parses again -- `pnpm build` moves past this file, and `grep -c "const stepRef" src/hooks/useLockFlow.ts` is 1 from 2.
next build runs ESLint, and two no-explicit-any errors stopped it: both i18n.ts and request.ts guarded their locale with `locales.includes(locale as any)`. The cast silenced the checker on a value that genuinely arrives from outside the process (the request), which is exactly the case the fallback exists for. Both now go through an isLocale() type predicate in i18n.ts, so the narrowing is real and the fallback keeps its meaning. The two files are otherwise near-identical duplicates; request.ts is imported by nothing, but removing dead code is a separate change.
|
Rebased onto current
Conflict that did need resolving, What remains in the diff (4 files, +451/−57): the lockfile sync, the locale guard in Verification, run on this branch: The same command on current So the build and the frozen install both pass here while |
df3163e to
0db5683
Compare
maindoes not build. Four separate defects, each of which takes the app down on its own. This PR fixes all four in one branch, because the point is a greenmain, not four separate red things.1.
src/components/Navbar/Navbar.tsx—useEffectwas never importedThe app crashes on load, and eleven Navbar unit tests were red on
main. They pass with the import restored (11/11).2.
src/hooks/useLockFlow.ts—stepRefdeclared twiceA merge artefact left two
const stepRefdeclarations in the same scope, so the module did not even parse (Module parse failed).3.
src/app/loading.tsx—SkeletonBar'swprop is narrower than its call sitesThe farm skeleton passes responsive Chakra values at six call sites, while the
Flexin the same component already takes a responsivedirectionthe same way — only the prop type was wrong.next buildfails on it, which is why every Netlify deploy preview in this repository comes back red, whichever branch triggered it. The type now comes from Chakra (BoxProps["w"]) rather than a hand-written union.4.
src/i18n.tsandsrc/request.ts—locales.includes(locale as any)next buildruns ESLint, and two@typescript-eslint/no-explicit-anyerrors stopped it there. The cast silenced the checker on a value that genuinely arrives from outside the process (the request), which is precisely the case the fallback exists for. Both now go through anisLocale()type predicate, so the narrowing is real.Verification
Plus, on the sibling branches: Navbar unit tests 11/11, farm e2e 5/5, visual-regression e2e 3/3.
Nothing was disabled, skipped or weakened to get here — no
eslint-disable, no@ts-ignore, no narrowed test globs. The four fixes are the whole diff.Two things I left alone on purpose, both out of scope:
src/request.tsis imported by nothing (near-duplicate ofi18n.ts, dead code — a separate change), and the build prints unused-variable warnings inuseLockFlow.ts,src/lib/*, andsrc/lib/soroban.tsthat predate this branch and do not fail the build.