EAP: Update schema for Save and submit functionality#2240
EAP: Update schema for Save and submit functionality#2240AdityaKhatri merged 3 commits intoproject/early-action-protocolsfrom
Conversation
|
f663360 to
21c940f
Compare
c9aef37 to
97a5803
Compare
| }); | ||
|
|
||
| const response = fullEapResponse ?? simplifiedEapResponse; | ||
| const pending = fullEapPending ?? simplifiedEapPending; |
There was a problem hiding this comment.
| const pending = fullEapPending ?? simplifiedEapPending; | |
| const pending = fullEapPending || simplifiedEapPending; |
| )} | ||
| > | ||
| {pending && <BlockLoading />} | ||
| {!pending && ( |
| "confirmStatusButtonLabel": "Confirm", | ||
| "updateStatusDescription": "Are you sure you want to update the status?", | ||
| "reviewChecklistDescription": "Upload the Review Checklist for the National Society to download and review. Make sure to keep a proper labeling of the file to avoid duplications.", | ||
| "editSimplifiedEapFormLinkLabel": "Edit sEAP", |
There was a problem hiding this comment.
| "editSimplifiedEapFormLinkLabel": "Edit sEAP", | |
| "editSimplifiedEapFormLinkLabel": "Edit simplified EAP", |
There was a problem hiding this comment.
No changes required in this. this is correct.
| </Label> | ||
| </ListView> | ||
| )} | ||
| {isDefined(hasFormErrors) && ( |
There was a problem hiding this comment.
I think we've already alerted the users. Is this necessary again?
There was a problem hiding this comment.
This alert is different it persist its state in the modal to show warning and error.
| const [fileIdToUrlMap, setFileIdToUrlMap] = useState<Record<number, string>>({}); | ||
|
|
||
| const updateFileUrlMapping = useCallback((response: GetSimplifiedResponse) => { | ||
| lastModifiedAtRef.current = response?.modified_at; |
There was a problem hiding this comment.
Move this setting right after we get data from the request as opposed to doing it during updateFileUrlMapping
| // NOTE it is here to clear the state and | ||
| // replace is necessary for not pushing a new entry |
There was a problem hiding this comment.
Mention in the note in a bit more detail about why the state was used and what happens if we don't replace it.
Also, try this:
window.history.replaceState({}, '')
There was a problem hiding this comment.
Navigating my trigger the request again that will lead to the onSuccess being triggered again.
| ); | ||
|
|
||
| const updateFileUrlMapping = useCallback((response: GetFullEapResponse) => { | ||
| lastModifiedAtRef.current = response?.modified_at; |
There was a problem hiding this comment.
Same as in the simplified form
|
|
||
| // NOTE it is here to clear the state and | ||
| // replace is necessary for not pushing a new entry | ||
| navigate( |
There was a problem hiding this comment.
Same as in the simplified form
| : undefined, | ||
| }); | ||
|
|
||
| const response = fullEapResponse ?? simplifiedEapResponse; |
There was a problem hiding this comment.
Can you add a note here why this is necessary?
I am a bit confused as to why simplified it sidelined 😋
There was a problem hiding this comment.
Both request runs in parallel only one will return data depending on which EAP type associated with the current context.
There was a problem hiding this comment.
SimplifiedEAP is not sidelined, its the fallback if you have any other way please suggest me.
- Add getIsSubmission context in form schema for save and submit functionality - Add lastModifiedAtRef to send modified_at while updating
a2bcbdb to
63d39b7
Compare
Changes
This PR Ensures:
console.logstatements meant for debugging