refactor(import): event-driven CSV validation + improved warning messages#769
Open
refactor(import): event-driven CSV validation + improved warning messages#769
Conversation
- Mobile: replace text filter button with icon-only, placed next to period selector - Desktop: reduce account selector height to h-9 to match period toggle
…ages Move draft creation and backend validation out of ReviewStep's useEffect and into handleNext (mapping→review transition), making initialization event-driven and eliminating the Strict Mode double-invoke workaround. - Extract pure helpers (parseDateValue, mapActivityType, mapSymbol, validateDraft, createDraftActivities, etc.) to utils/draft-utils.ts - Move validateDrafts + isValidating into ImportProvider so both handleNext and handleSymbolResolution share one instance with one race-condition guard (validationRunRef) - ReviewStep becomes purely presentational: no useEffect, no local validation state, reads isValidating from context - Fix warning tooltip to suppress internal key prefixes (keys starting with '_' show message only) - Improve _quote_ccy_fallback warning to include symbol and inferred currency: "SXLK price currency was inferred as USD from the exchange."
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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
handleNext(mapping→review transition) instead of auseEffectinsideReviewStep. Eliminates the React Strict Mode double-invoke workaround (hasInitiatedRef).validateDraftsmoved toImportProvider: single shared instance with onevalidationRunRefrace-condition guard, used by bothhandleNextandhandleSymbolResolution.isValidatingmoved to context state:ReviewStepmounts with the spinner already showing (validation was started by the parent before the step animated in).ReviewStepis now purely presentational: nouseEffect, no local validation state, nouseRefguards.utils/draft-utils.ts(parseDateValue,mapActivityType,mapSymbol,validateDraft,createDraftActivities, etc.) so both the parent and future consumers can call them without importing from a step component._(internal keys like_quote_ccy_fallback) no longer appear as a label in the tooltip — only the message is shown._quote_ccy_fallbacknow reads "SXLK price currency was inferred as USD from the exchange. Please confirm it is correct."Test plan
check_activities_importcall in logs per Next click_quote_ccy_fallbackprefix