Skip to content
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

Update route summary tooltip with correct time and correct URL Routing #51

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

wdcsimon
Copy link

@wdcsimon wdcsimon commented Jan 16, 2023

Time is reported wrong in route summary tooltip when hovering over route. Apply same fix as used in Issue #12
Correct URL Routing for directions and isochrones

Time is reported wrong in route summary tooltip when hovering over route.  Apply same fix as used in Issue gis-ops#12
Use # instead of / for correct URL routing
Correct URL routing for directions and isochrones
@wdcsimon wdcsimon changed the title Update route summary tooltip with correct time Update route summary tooltip with correct time and correct URL Routing Jan 16, 2023
Copy link
Member

@nilsnolde nilsnolde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix. Just one thing to clarify.

@@ -63,7 +63,7 @@ export const updatePermalink = () => (dispatch, getState) => {
const queryParams = new URLSearchParams()
queryParams.set('profile', profile)

let path = '/directions?'
let path = '#directions?'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems wrong, can you elaborate here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically "directions" or "isochrones" are not physical files, but handlers, so they should follow a # rather that a / as this provides correct URL routing. If we use the / then if a user does a browser page refresh, they end up generating a 404-error page, by using the # we avoid this potential issue. See https://maps.whanganui.govt.nz/routing to see this in action.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically "directions" or "isochrones" are not physical files, but handlers

Right, as a web dev noob I figured that's mostly syntactical in real life if using / or #.

What I can see on your demo page, it's not properly resolving permalinks, i.e. page refreshes fail to parse the full URL into a parameterized version of the web app. E.g. this: https://maps.whanganui.govt.nz/routing/#directions?profile=bicycle&wps=175.02682766786324%2C-39.91050190801741%2C175.04880524660373%2C-39.93498734998717, would generate a route from the waypoints on https://valhalla.openstreetmap.de/.

Wouldn't you also have to update the function which parses the URL from a permalink?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though I'm still open to adhering to proper standards (if that's what it is), but another point is people already pointing to the app, in all the issues in upstream Valhalla etc. If there's no really good reason to change it, I wouldn't like to include that in the merge, it'd mess up all existing links (I know I can tell Apache to deal with this, but again, needs a good reason for me).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point about the permalink, the # doesn't help with that. Will look at how that can be resolved.
Probably better to stick with the / at the moment.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think @chrstnbwnkl convinced me about the #, I always wondered why so many SPAs do that. Anyways, I guess we'll just need to update the URL parsing function to trigger permalinks on #. I'd guess it could be done in a backwards-compatible way so that old / URLs are still resolved properly, e.g. from open Valhalla issues. There's custom code in the app for that, I remember.

If you don't have the time for that @wdcsimon let us know and we'll handle it at some point. Thanks anyway!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants