Skip to content

Comments

EAP: Update schema for Save and submit functionality#2240

Open
shreeyash07 wants to merge 4 commits intoproject/early-action-protocolsfrom
feature/eap-schema
Open

EAP: Update schema for Save and submit functionality#2240
shreeyash07 wants to merge 4 commits intoproject/early-action-protocolsfrom
feature/eap-schema

Conversation

@shreeyash07
Copy link
Collaborator

Changes

  • Add EapObsolete resolution modal for EAP Forms
  • Add getIsSubmission context in form schema for save and submit functionality
  • Add lastModifiedAtRef to send modified_at while updating

This PR Ensures:

  • No typos or grammatical errors
  • No conflict markers left in the code
  • No unwanted comments, temporary files, or auto-generated files
  • No inclusion of secret keys or sensitive data
  • No console.log statements meant for debugging
  • All CI checks have passed

Additional Notes

Optional: Add any other relevant context, screenshots, or details here.

@changeset-bot
Copy link

changeset-bot bot commented Feb 16, 2026

⚠️ No Changeset found

Latest commit: ec18450

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@shreeyash07 shreeyash07 changed the title EAP: changes in EAP: Update schema for Save and submit functionality Feb 16, 2026
- Add getIsSubmission context in form schema for save and submit
  functionality
- Add lastModifiedAtRef to send modified_at while updating
const strings = useTranslation(i18n);

const { pending: fullEapPending, response: fullEapResponse } = useRequest({
skip: isNotDefined(fullEapId) || isDefined(simplifiedEapId),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why skip fullEap if simplifiedEap is not defined?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we don't need full response in simplified form.

});

const { pending: simplifiedEapPending, response: simplifiedEapResponse } = useRequest({
skip: isNotDefined(simplifiedEapId) || isDefined(fullEapId),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why skip simplifiedEap if fullEap is not defined?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we don't need simplified response in full form.

});

const response = fullEapResponse ?? simplifiedEapResponse;
const pending = fullEapPending ?? simplifiedEapPending;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const pending = fullEapPending ?? simplifiedEapPending;
const pending = fullEapPending || simplifiedEapPending;

)}
>
{pending && <BlockLoading />}
{!pending && (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this necessary?

"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",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"editSimplifiedEapFormLinkLabel": "Edit sEAP",
"editSimplifiedEapFormLinkLabel": "Edit simplified EAP",

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No changes required in this. this is correct.

</Label>
</ListView>
)}
{isDefined(hasFormErrors) && (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we've already alerted the users. Is this necessary again?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this setting right after we get data from the request as opposed to doing it during updateFileUrlMapping

Comment on lines 377 to 378
// NOTE it is here to clear the state and
// replace is necessary for not pushing a new entry
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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({}, '')

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as in the simplified form

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants