Repository navigation
fix(network): validate custom network inputs before saving (#39) - #49
Open
produckq-boop wants to merge 1 commit into
Open
produckq-boop wants to merge 1 commit into
produckq-boop wants to merge 1 commit into
Conversation
- Validate required name, RPC URL, and passphrase fields, and require well-formed http(s) URLs for RPC and optional Horizon endpoints - Render field-level inline validation errors and disable Save until the form is valid - Trim inputs before saving, reject duplicate network names case-insensitively across built-in and saved custom networks, and guard persisted entries in NetworkContext - Surface non-blocking RPC reachability status without preventing valid networks from being saved - Add unit and component tests covering validation, duplicate prevention, trimming, reachability probing, and network selection
|
@produckq-boop is attempting to deploy a commit to the Prisca's projects Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #39
Summary
Validates custom network entries in
NetworkSwitcherbefore persisting them so invalid names, malformed URLs, or missing passphrases cannot be saved into active network state.What Changed
src/config/network.ts,src/components/NetworkSwitcher.tsx):isValidHttpUrlto require well-formedhttp:orhttps:URLs with valid hostnames and no internal whitespace.validateCustomNetworkFormto require non-emptyname,rpcUrl, andpassphrase, validaterpcUrl(andhorizonUrlwhen provided) ashttp(s)URLs, and reject duplicate network names case-insensitively against both built-in (Testnet,Mainnet,Futurenet) and saved custom networks.src/components/NetworkSwitcher.tsx,src/contexts/NetworkContext.tsx):role="alert",aria-invalid,aria-describedby) on field interaction/blur or submit, and keptSave & switchdisabled until all fields are valid.name,rpcUrl,horizonUrl, andpassphrasebefore validation and persistence, and guardedNetworkContextagainst malformedlocalStorageentries.src/components/NetworkSwitcher.tsx):300ms) and on-demand (Check RPC) JSON-RPCgetHealthprobing withAbortControllercleanup and a4stimeout, surfacing reachability status (role="status") without blocking save when an endpoint is offline or unreachable.test/NetworkSwitcher.test.tsx):isValidHttpUrl,validateCustomNetworkForm, malformed RPC URLs, blank/whitespace required fields, optional Horizon URL validation, case-insensitive duplicate name checks, trimmed persistence and network re-selection, non-blocking RPC reachability states, form cancellation, and malformedlocalStoragefiltering.Verification
npm run lintnpx prettier --check src/config/network.ts src/contexts/NetworkContext.tsx src/components/NetworkSwitcher.tsx test/NetworkSwitcher.test.tsxnpx tsc --noEmitnpm run buildnpm test(21/21 test files, 179/179 tests passing)