Skip to content

Keep both Landing buttons local during npm run dev - #52

Open
blue442 wants to merge 1 commit into
mainfrom
fix/landing-local-dev-both-buttons
Open

Keep both Landing buttons local during npm run dev#52
blue442 wants to merge 1 commit into
mainfrom
fix/landing-local-dev-both-buttons

Conversation

@blue442

@blue442 blue442 commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • In dev mode only (import.meta.env.DEV), the "Brown County" button on Landing.jsx now routes locally via <Link to="/simulation"> instead of an <a href> to the live staging pod.
  • Production builds are unchanged — import.meta.env.DEV is false for npm run build, so the Brown County button still points at https://fassfrontstage.pods.icicleai.tapis.io/ there.

Background

Reported while setting up local dev: clicking "Brown County" on the Landing page kicks you out of localhost entirely and over to the live staging deployment, so there's no way to stay local and reach /simulation via that button. (A related, separate complaint: /simulation shows whatever county data the local backend at 127.0.0.1:8000 happens 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, main here is a real two-live-deployment chooser (main → Franklin prod pod, "Brown County" → separate staging pod, 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 on import.meta.env.DEV keeps prod behavior intact while fixing the local dev annoyance.

Verification

  • npm run build succeeds.
  • Confirmed the built dist/assets/*.js output still contains the fassfrontstage.pods.icicleai.tapis.io staging 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 /simulation without leaving localhost.
  • npm run build && npm run preview (or check the deployed prod pod) — "Brown County" should still link out to fassfrontstage.pods.icicleai.tapis.io.

🤖 Generated with Claude Code

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.
@blue442
blue442 requested a review from MiniMiniFridge July 2, 2026 19:26

@MiniMiniFridge MiniMiniFridge left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 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.

  1. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants