Bugfix/issue 2263 - #2265
Merged
Merged
Conversation
|
This pull request is automatically being deployed by Amplify Hosting (learn more). |
…nstead of whole data object
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the AddEvent page’s behavior when navigating to related entities (organization/person/place) from within the event form, especially for published events, and fixes incorrect form error field mapping so invalid nested entities display correct values.
Changes:
- Fixes form field error mapping to set each field’s value from
errors[fieldName].value(instead of the entiredataobject). - Refactors the related-entity navigation handler by extracting
saveAndNavigate, and adds logic to switch published events to draft before navigating away.
Comments suppressed due to low confidence (2)
src/pages/Dashboard/AddEvent/AddEvent.jsx:2004
- Use strict equality here to avoid unintended type coercion when comparing the normalized
typeto taxonomy constants.
else if (type?.toUpperCase() == taxonomyClass.PERSON)
src/pages/Dashboard/AddEvent/AddEvent.jsx:2013
- Use strict equality here to avoid unintended type coercion when comparing the normalized
typeto taxonomy constants.
else if (type?.toUpperCase() == taxonomyClass.PLACE)
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.
This pull request makes several improvements to the
AddEventpage, primarily focusing on navigation logic, event state management, and form error handling. The changes ensure that navigation to related entities (like organizations) works more reliably, and that events are properly saved as drafts before navigating away, especially when editing published events.Navigation and event state management:
organizerPerformerSupporterPlaceNavigationHandlerfunction now checks if the event is published, and if so, updates its state to draft before continuing navigation. This ensures edits are not lost and the event is in the correct state before navigating away.Form error handling:
errors[fieldName].valueinstead of the entiredataobject, ensuring form fields display the correct error values.Code structure improvements:
saveAndNavigatefunction for better readability and reusability.