fix error handling, type safety, and several bugs - #614
Open
YashejShah wants to merge 4 commits into
Open
YashejShah wants to merge 4 commits into
YashejShah wants to merge 4 commits into
Conversation
|
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.
summary
spent some time going through the codebase and found a bunch of issues worth fixing — from actual bugs to type safety gaps.
highlights
error handling
errorBoundarywas casting Error objects to string, turning every error message into[object Object]. fixed to properly extract message and preserve stack tracesres.okchecks on all geo module fetch calls — 404/500 responses were being parsed as JSON and silently failingphone number module
matchesEntirelywas constructing a new RegExp on every call with complex country patterns. added a cache to avoid redundant compilationcleanPhoneNumberhad a nonsensical(?!A)\+regex — simplified to actually do what it's supposed tocurrency
convertToMinorUnitwas using floating point multiplication (amount * multiplier) which is unreliable for currency math. switched to Math.roundformatNumberwas accepting hex strings and Infinity as valid numbersreact provider
updateI18nStatehad a stale closure bug — global state was being set with old values instead of the updated onesuseI18nContexterror check never fired because the default context value was{}(truthy). fixed by usingundefinedas defaulttypes
as anycastsdirectiontype that was'ltr' | 'rtl' | string(equivalent to juststring)rawParts.valuefromunknowntostringdates
99— added proper range checkall changes are backwards compatible.