You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@jgrund Hi, I'm using a base tag in my seed app. When it's not / it seems to break routing. Is there a way to configure routing to work with a non / base?
In dev mode I want to have a / base, but in prod I want to have a /ui base
It would be nice if seed could account for what the base is and basically remove it from routing configs
Otherwise it seems that I need to conditionally account for what the base is dependant on the environment
Design decisions:
Where we want to setup router base path? (In App builder, get from base tag from head, etc.)
Should we change Url behaviour? I.e. base path would be trimmed from Url::path.
How does it alter routing.rs functions behavior?
How will be a tags handled?
..
The text was updated successfully, but these errors were encountered:
How to get base path in JS - basePath = new URL(document.baseURI).pathname.
As the result, we can set base url directly in HTML, which should allows us to easily change it through ENV variables and bundlers.
Ad 2) Yes.
Ad 3) It looks like there shouldn't be any changes, but we should test it.
Ad 4)a link should be handled automatically thanks to base & href in head.
The big PR #411 that resolves many Url/project scaling-related issues, including this one, has been merged. @jgrund Please reopen it once you have some problems with it (bugs, strange API, ..).
I recommend to play with new examples url and pages that both exercise the new functionality and app patterns - clone the repo and run e.g. cargo make start pages and then go to localhost:8000.
How it works:
Seed tries to read <base href="ui"> during app start and extract a path from it. The extracted path is called base_path. If there is no base element or there were problems during casting, the default (empty / root) path is used.
Seed passes Url into your init function or UrlChanged subscription message. However it modifies it a little bit before passing - it calls url.skip_base_path(base_path). skip_base_path advances internal path iterator if base_path is prefix of the url path - so url.next_path_part() returns a instead of ui if the base_path is ui and the url is /ui/a/xxx.
Design decisions:
App
builder, get frombase
tag fromhead
, etc.)Url
behaviour? I.e. base path would be trimmed fromUrl::path
.routing.rs
functions behavior?a
tags handled?The text was updated successfully, but these errors were encountered: