LG-10405: Add full address entry form for PO search (behind feature flag)#8815
LG-10405: Add full address entry form for PO search (behind feature flag)#8815
Conversation
| inPersonFullAddressEntryEnabled: Boolean; | ||
| } | ||
|
|
||
| function DocumentCapture({ | ||
| onStepChange = () => {}, | ||
| inPersonFullAddressEntryEnabled, | ||
| }: DocumentCaptureProps) { | ||
| function DocumentCapture({ onStepChange = () => {} }: DocumentCaptureProps) { | ||
| const [formValues, setFormValues] = useState<Record<string, any> | null>(null); | ||
| const [submissionError, setSubmissionError] = useState<Error | undefined>(undefined); | ||
| const [stepName, setStepName] = useState<string | undefined>(undefined); | ||
| const { t } = useI18n(); | ||
| const { flowPath } = useContext(UploadContext); | ||
| const { trackSubmitEvent, trackVisitEvent } = useContext(AnalyticsContext); | ||
| const { inPersonURL } = useContext(InPersonContext); | ||
| const { inPersonFullAddressEntryEnabled, inPersonURL } = useContext(InPersonContext); |
There was a problem hiding this comment.
This is addressing Andrew's feedback from the prior PR for a cleaner way to pass the feature flag into the Document Capture context
|
|
||
| /** | ||
| * When true users must enter a full address when searching for a Post Office location | ||
| */ | ||
| inPersonFullAddressEntryEnabled: boolean; |
There was a problem hiding this comment.
This is addressing Andrew's feedback from the prior PR for a cleaner way to pass the feature flag into the Document Capture context
| inPersonURL, | ||
| inPersonOutageMessageEnabled: inPersonOutageMessageEnabled === 'true', | ||
| inPersonOutageExpectedUpdateDate, | ||
| inPersonFullAddressEntryEnabled: inPersonFullAddressEntryEnabled === 'true', |
There was a problem hiding this comment.
This is addressing Andrew's feedback from the prior PR for a cleaner way to pass the feature flag into the Document Capture context
| DocumentCapture, | ||
| { | ||
| onStepChange: extendSession, | ||
| inPersonFullAddressEntryEnabled: inPersonFullAddressEntryEnabled === 'true', |
There was a problem hiding this comment.
This is addressing Andrew's feedback from the prior PR for a cleaner way to pass the feature flag into the Document Capture context
…d full address PO search form
bad88a8 to
8b3959b
Compare
...ocument-capture/components/in-person-location-full-address-entry-post-office-search-step.tsx
Show resolved
Hide resolved
app/javascript/packages/document-capture/components/in-person-full-address-search.tsx
Show resolved
Hide resolved
| // ref allows us to avoid a memory leak | ||
| const mountedRef = useRef(false); | ||
|
|
||
| useEffect(() => { | ||
| mountedRef.current = true; | ||
| return () => { | ||
| mountedRef.current = false; | ||
| }; | ||
| }, []); |
There was a problem hiding this comment.
Looks like a good use case for useIfStillMounted
| setTimeout(() => { | ||
| if (mountedRef.current) { | ||
| setDisabledAddressSearch(false); | ||
| } | ||
| }, 250); |
There was a problem hiding this comment.
Not sure I'm following what and why we're disabling and setting a timeout for an arbitrary time period.
There was a problem hiding this comment.
Is there some custom validation errors we're trying to reset with these calls? I don't see where we're doing that custom validation.
…anual-address-entry-form
8b3959b to
f0723db
Compare
|
closing in favor of #8824; comments will be addressed there |
WIP
🎫 Ticket
LG-10405
🛠 Summary of changes
tbd