feature/preparedness#6
Merged
Merged
Conversation
shreeyash07
approved these changes
Jun 22, 2026
subinasr
requested changes
Jun 23, 2026
Comment on lines
106
to
112
| const pageOptions = useMemo( | ||
| () => enumsData?.enums?.DashboardPage?.filter( | ||
| (option) => option.key !== DashboardPage.EmergencyAlerts | ||
| && option.key !== DashboardPage.DisasterResponse, | ||
| (option) => option.key === DashboardPage.ProjectMapping | ||
| || option.key === DashboardPage.EmergencyResponse, | ||
| ), | ||
| [enumsData], | ||
| ); |
There was a problem hiding this comment.
I think we can simply hardcode this pageOptions as long as it is typesafe.
Comment on lines
29
to
34
| const pageOptions = useMemo( | ||
| () => enumsData?.enums?.DashboardPage?.filter( | ||
| (option) => option.key !== DashboardPage.EmergencyAlerts | ||
| && option.key !== DashboardPage.DisasterResponse, | ||
| (option) => option.key === DashboardPage.ProjectMapping | ||
| || option.key === DashboardPage.EmergencyResponse, | ||
| ), | ||
| [enumsData], |
| }), | ||
| }; | ||
|
|
||
| const defaultEditFormValue: PartialFormType = { |
There was a problem hiding this comment.
Suggested change
| const defaultEditFormValue: PartialFormType = { | |
| const defaultFormValue: PartialFormType = { |
Comment on lines
+135
to
+141
| if (isDefined(result) && result.ok) { | ||
| navigate(redirectPath); | ||
| alert.show(alertMessage, { variant: 'success' }); | ||
| } else if (isDefined(result) && isDefined(result.errors)) { | ||
| setError(result.errors); | ||
| alert.show(result.errors[0]?.messages, { variant: 'danger' }); | ||
| } |
There was a problem hiding this comment.
We also need to handle for cases when the result object is returned empty from the server. It shouldn't happen but we need to handle it too.
|
|
||
| const pending = createPending || updatePending || detailFetching; | ||
|
|
||
| const handleMutation = useCallback(async (mutationData: PartialFormType) => { |
There was a problem hiding this comment.
Can we separate out the create and update handler functions rather than using multiple ifs on the same function?
Contributor
Author
There was a problem hiding this comment.
createSubmitHandler takes a single callback, so let's keep it as one handler rather than separating create/update.
| (id: string) => { | ||
| deleteExternalDashboard({ id }).then((resp) => { | ||
| const result = resp.data?.deleteExternalDashboard; | ||
| if (isDefined(result) && 'ok' in result && result.ok) { |
There was a problem hiding this comment.
Why are we using 'in' here instead of simply checking for result.ok?
| alert.show('Dashboard deleted successfully', { variant: 'success' }); | ||
| return; | ||
| } | ||
| const message = isDefined(result) && 'messages' in result |
crsstha
approved these changes
Jun 24, 2026
dde735d to
1ba7f74
Compare
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.
Changes
This PR doesn't introduce any
console.logmeant for debugging