Skip to content

feat: hide Hardhat network from home page in production/staging - #75

Merged
AugustoL merged 2 commits into
devfrom
hide-localhost
Nov 29, 2025
Merged

AugustoL merged 2 commits into
devfrom
hide-localhost

Conversation

@AugustoL

Copy link
Copy Markdown
Collaborator

This pull request updates the logic for displaying enabled networks on the Home page. The main improvement is that the "Hardhat" network (chain ID 31337) is now hidden from the home page unless the application is running in development mode or it is explicitly enabled via the REACT_APP_OPENSCAN_NETWORKS environment variable.

closes #53

Network display logic improvements:

  • Updated the enabledNetworks logic in Home.tsx to filter out the Hardhat network (chain ID 31337) from the home page unless the app is running in development or Hardhat is explicitly listed in the REACT_APP_OPENSCAN_NETWORKS environment variable.

The Hardhat network link is now only shown on the home page when:
- Running in development mode, OR
- Explicitly included in REACT_APP_OPENSCAN_NETWORKS

The network remains accessible via direct URL navigation to /31337
@AugustoL
AugustoL requested a review from MatiasOS November 29, 2025 12:06
@github-actions

github-actions Bot commented Nov 29, 2025 •

Copy link
Copy Markdown

🚀 Preview: https://pr-75--openscan.netlify.app
📝 Commit: f198167892e5a2965ae7d43fb495ad5e3896de88

const allNetworks = getEnabledNetworks();
const environment = process.env.REACT_APP_ENVIRONMENT;
const isDevelopment = environment === "development";
const envNetworks = process.env.REACT_APP_OPENSCAN_NETWORKS;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It is unclear how and where to add the networks to enable localhost development.
We can add it to a .env.example file or instructions in README.md.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Added readme documentation about REACT_APP_OPENSCAN_NETWORKS on the readme, but teh rest is very clear, if you run it locally with npm start you will see localhost as an option on home, this PR only removes the localhost button on the home for staging and production deploys.
So if a developer using hardhat/anvil download the repo and runs the explorer with npm start it would be able to navigate on localhost with no problems.
Even so, localhost is still usabe on stagin and production via url path.

@AugustoL
AugustoL merged commit 87892c8 into dev Nov 29, 2025
1 check passed
@AugustoL
AugustoL deleted the hide-localhost branch November 29, 2025 20:14
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