Keep both Landing buttons local during npm run dev - #52
Conversation
During local development, /simulation shows whatever county data the developer's local backend (127.0.0.1:8000) happens to have loaded, regardless of which button was clicked. The "Brown County" button previously used a plain <a href> to the live staging pod (fassfrontstage...), which yanked local devs out of localhost while debugging - there was no way to stay local and see /simulation. In dev mode (import.meta.env.DEV, true only for `npm run dev`), both buttons now route locally via <Link to="/simulation">. Production builds are unaffected: `import.meta.env.DEV` is false for `npm run build`, so the Brown County button still points at the staging deployment there - preserving the two-live-deployment chooser that main's Landing page exists for. Verified fassfrontstage URL is still present in the production build output after this change. Labeling which literal county's data is present locally is a separate, harder problem (the local backend doesn't report which dataset it's loaded with) and is out of scope here.
MiniMiniFridge
left a comment
There was a problem hiding this comment.
- Verified locally:
- ✅ npm run build succeeds.
- ✅ Production bundle still contains fassfrontstage.pods.icicleai.tapis.io, confirming the dev-only branch is dead-code-eliminated and the live-deployment chooser is preserved.
- ✅ In npm run dev, the Brown County button renders as and stays on localhost.
- ✅ Gating on import.meta.env.DEV (vs. blindly making both buttons unconditionally, as done in the FoodAccessSimulator/FEAST-frontend fork) correctly preserves this repo's two-live-deployment production behavior. Good judgment call.
- One issue that needs addressing before merge:
The "← Landing" button in TopBar.jsx has the same problem this PR is fixing on Landing.jsx, but it's not covered. In dev, clicking Franklin County → simulation → "← Landing" hard-navigates to https://feast.pods.icicleai.tapis.io/, kicking you out of localhost.
The offending line (TopBar.jsx):
onClick={() => { window.location.href = 'https://feast.pods.icicleai.tapis.io/'; }}
This should be gated on import.meta.env.DEV the same way, e.g.:
{import.meta.env.DEV ? (
← Landing ) : ( { window.location.href = 'https://feast.pods.icicleai.tapis.io/'; }} style={{ marginRight: 8 }} > ← Landing )}Without this, the local dev experience is still broken by one click — user goes Landing → sim → back → and they're on the deployed prod pod again. Same class of bug, same fix pattern.
Test plan additions:
Suggest adding one more manual test step:
- After clicking Franklin County → simulation, click "← Landing" — should return to localhost:5173/, not the prod pod URL.
- Once TopBar's "← Landing" is patched with the same pattern, this is ready to merge.
Summary
import.meta.env.DEV), the "Brown County" button onLanding.jsxnow routes locally via<Link to="/simulation">instead of an<a href>to the live staging pod.import.meta.env.DEVisfalsefornpm run build, so the Brown County button still points athttps://fassfrontstage.pods.icicleai.tapis.io/there.Background
Reported while setting up local dev: clicking "Brown County" on the Landing page kicks you out of
localhostentirely and over to the live staging deployment, so there's no way to stay local and reach/simulationvia that button. (A related, separate complaint:/simulationshows whatever county data the local backend at127.0.0.1:8000happens to have loaded, regardless of which button was clicked — the labels can't know that without a backend change, so that part is out of scope here, same as noted in the original report.)This mirrors a fix already applied downstream in
FoodAccessSimulator/FEAST-frontend(PR #11), but adapted for this repo's architecture: unlike that fork,mainhere is a real two-live-deployment chooser (main→ Franklin prod pod, "Brown County" → separatestagingpod, per PR #51's "Remove Landing.jsx and router from staging"). Blindly making both buttons<Link>unconditionally, as the fork's patch does, would have broken that production chooser. Gating onimport.meta.env.DEVkeeps prod behavior intact while fixing the local dev annoyance.Verification
npm run buildsucceeds.dist/assets/*.jsoutput still contains thefassfrontstage.pods.icicleai.tapis.iostaging URL (i.e., dev-only branch is correctly stripped from the production bundle).Test plan
npm run dev, click both "Franklin County" and "Brown County" — both should navigate to local/simulationwithout leavinglocalhost.npm run build && npm run preview(or check the deployed prod pod) — "Brown County" should still link out tofassfrontstage.pods.icicleai.tapis.io.🤖 Generated with Claude Code