-
Notifications
You must be signed in to change notification settings - Fork 0
ERA-10349: Support EFB schemas in ER > Location Field [2] #1263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react' | |
|
||
import { FORM_ELEMENT_TYPES, ROOT_CANVAS_ID } from './constants'; | ||
import makeFieldsFromSchema from './utils/makeFieldsFromSchema'; | ||
import useLocationMarkersLayer from './utils/useLocationMarkersLayer'; | ||
import useMapLocationMarkers from './utils/useMapLocationMarkers'; | ||
import useSchemaValidations from './utils/useSchemaValidations'; | ||
|
||
import Collection from './fields/Collection'; | ||
|
@@ -23,7 +23,9 @@ export const FIELDS = { | |
|
||
const SchemaForm = ({ | ||
autofillDefaultInputs, | ||
eventId, | ||
eventLocation, | ||
hideMapLocationMarkers, | ||
initialFormData, | ||
onFormDataChange, | ||
onFormSubmit, | ||
|
@@ -48,8 +50,8 @@ const SchemaForm = ({ | |
const { | ||
blurLocationMarker, | ||
focusLocationMarker, | ||
updateLocationMarkers | ||
} = useLocationMarkersLayer(eventLocation, onLocationMarkerClick); | ||
setLocationMarkers, | ||
} = useMapLocationMarkers(eventId, eventLocation, onLocationMarkerClick, hideMapLocationMarkers); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
|
||
// This ref works as a flag to trigger a useEffect and call onFormDataChange asynchronously when there are changes in | ||
// the form data, so we can keep the onSectionFieldChange dependency array empty. | ||
|
@@ -160,8 +162,8 @@ const SchemaForm = ({ | |
}; | ||
addLocationMarkersFromFormDataRecursively(formData); | ||
|
||
updateLocationMarkers(locationMarkers); | ||
}, [fields, formData, updateLocationMarkers]); | ||
setLocationMarkers(locationMarkers); | ||
}, [fields, formData, setLocationMarkers]); | ||
|
||
return <form onSubmit={onSubmit}> | ||
{fields[ROOT_CANVAS_ID]?.details.fields.map((sectionId) => <Section | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes the issue when chosing a location and clicking something that is not the map. We just remove the listener while user picks a location so its logic doesn't un-focuses the location picker getting the app into a broken state.