all repos — caroster @ b8a33aa0d3bd3ec778776c1cc1193c315427340b

[Octree] Group carpool to your event https://caroster.io

🐛 Update map on travel's address update #388
Simon Mulquin simon@octree.ch
Wed, 13 Dec 2023 12:01:27 +0000
commit

b8a33aa0d3bd3ec778776c1cc1193c315427340b

parent

54cb6c4b8a7dd7edbecc198ae921331a52d5aa90

M frontend/containers/Travel/index.tsxfrontend/containers/Travel/index.tsx

@@ -49,6 +49,7 @@ position: 'relative',

boxShadow: focused ? `0px 0px 5px 2px ${theme.palette.primary.main}` : 'none', + scrollMarginTop: theme.spacing(2) }} id={travel.id} >
M frontend/containers/Travel/useActions.tsxfrontend/containers/Travel/useActions.tsx

@@ -66,7 +66,14 @@ travelUpdate: {

...travelUpdate, }, }, - refetchQueries: ['eventByUUID'], + refetchQueries: [ + { + query: EventByUuidDocument, + variables: { + uuid: event.uuid, + }, + }, + ], }); } catch (error) { console.error(error);
M frontend/containers/TravelColumns/index.tsxfrontend/containers/TravelColumns/index.tsx

@@ -70,12 +70,15 @@ );

const {latitude, longitude} = event; const showMap = latitude && longitude; + let coordsString = ''; const markers = travels.reduce((markers, travel) => { const { attributes: {meeting_latitude, meeting_longitude}, } = travel; if (meeting_latitude && meeting_longitude) { const travelObject = {id: travel.id, ...travel.attributes}; + coordsString = + coordsString + String(meeting_latitude) + String(meeting_longitude); return [ ...markers, {

@@ -87,7 +90,7 @@ }

return markers; }, []); - const mapUpdateKey = `${event.uuid}.travels`; + const mapUpdateKey = `${event.uuid}.travels+${coordsString}`; if (preventUpdateKey !== mapUpdateKey) { setPreventUpdateKey(mapUpdateKey); setCenter([latitude, longitude]);

@@ -95,7 +98,7 @@ setMarkers([

{ double: true, center: [latitude, longitude], - popup: <EventPopup event={event}/> + popup: <EventPopup event={event} />, }, ...markers, ]);