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

changing url at runtime #242

Open
joleeee opened this issue Oct 28, 2024 · 3 comments
Open

changing url at runtime #242

joleeee opened this issue Oct 28, 2024 · 3 comments

Comments

@joleeee
Copy link

joleeee commented Oct 28, 2024

is this supported? update the api url and recalculate path

@smellyshovel
Copy link
Collaborator

smellyshovel commented Oct 28, 2024

@joleeee As far as I remember, no. You'd have to re-instantiate the Directions object with a new URL instead.
On the other hand, it is possible to save the currently displayed routes before doing so and then re-apply them after re-instantiating the instance, thus creating an illusion of a seamless URL change.

Otherwise, it should also be pretty straightforward to implement on the library level. So feel free to open a PR, if you decide to work on this.


UPD. If you need to "recalculate path", then it's even simpler, I bet. You just save the current waypoints' positions before re-instantiating the plugin, and then feed them back to the new instance with addWaypoint. There may be a small blink, however, while the changes are being applied. If this is crucial for you not to have it, then you can take the approach I described above.

@joleeee
Copy link
Author

joleeee commented Oct 28, 2024

Given that it only happens with this package, I'm thinking it might be a package.json type of bug. Maybe the dependency is not pruned when building for dev, or when building for production in the standard way.

I will try making a small MVP by the weekend

@smellyshovel
Copy link
Collaborator

Given that it only happens with this package, I'm thinking it might be a package.json type of bug. Maybe the dependency is not pruned when building for dev, or when building for production in the standard way.

I will try making a small MVP by the weekend

I'd argue that the package.json is a pretty standard one. But yeah, would be nice if you could create a repro. LMK when there's any update.

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

No branches or pull requests

2 participants