-
-
Notifications
You must be signed in to change notification settings - Fork 19
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
Directions: Add marker on map + improve instruction panel #761
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
3937787
to
eb2d6fd
Compare
eb2d6fd
to
4a06b9f
Compare
4a06b9f
to
72f62c6
Compare
72f62c6
to
94b6485
Compare
94b6485
to
fda55fc
Compare
const onDragEnd = () => { | ||
const lngLat = markerRef.current?.getLngLat(); | ||
if (lngLat) { | ||
setValue(getCoordsOption([lngLat.lng, lngLat.lat])); | ||
} | ||
}; | ||
|
||
markerRef.current?.on('dragend', onDragEnd); |
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.
I think this should be inside the useEffect above. Currently this would add the listener on every component render, that can degrade the app dramatically.
@@ -146,6 +159,46 @@ export const DirectionsAutocomplete = ({ label, value, setValue }: Props) => { | |||
const { userSettings } = useUserSettingsContext(); | |||
const { isImperial } = userSettings; | |||
|
|||
const ALPHABETICAL_MARKER = useMemo(() => { |
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.
Could you perhaps extract this functionality to a custom hook?
|
||
useEffect(() => { | ||
const map = getGlobalMap(); | ||
if (value?.type === 'coords') { |
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.
If the value is type 'geocoder', the marker isn't shown.
btw, I love the new look of the Results panel. And also the green markers/circles are just beatiful! 🥇 |
Thanks for your awesome work @jvaclavik ! ❤️ I observed that when a route has been generated, and a user decides to switch transportation mode, it doesn't automatically re-route, and the user needs to hit the "get directions" button again. Don't you think it's more convenient for users to see the new route when they change the transportation mode? |
It seems like this broke ssr. Opening this doesn't work but when it is generated on the client it works just fine |
Description
Example links
Screenshots
Checklist