Comments (3)
The base
prop on the Router
component is not intended to be changed during the lifetime of the component. It's primary purpose is to provide a convenient way configure applications that are hosted at some path other than the root.
My biggest question for supporting a dynamic router base
is what is the expectation of the matched routes when you change the base? For instance if the browsers is at /old/about
and you change the base from old
to new
, no routes will match until you navigate to /new/about
. Should the router navigate there automatically? Is there a common use-case here I'm not seeing?
from solid-router.
My use case is that our website use the base as the i18n location. For example base en-us
and at https:/example.com/en-us/about
page, after user change their language to zh-cn
then update base
to zh-cn
and call navigator('/about')
to /zh-cn/about
.
My workaround now is refresh the page using the window.location.href
.
from solid-router.
The workaround is pretty reasonable. Since the base is outside of the routers dynamic path matching it would be interesting to decide what the behavior should be. I'd lean towards routing to that given we don't want to be in an inconsistent state with the browser.. but it also doesn't really work both ways.. like if you press browser back we can't restore the language setting. I don't know if the router can take responsibility for the base in this sense.
from solid-router.
Related Issues (20)
- Slow page changing HOT 11
- Thrown `redirect`'s inside of `cache` are not being catched anymore for all versions after `0.12.0` HOT 2
- [Bug?]: Parameters don't get filled in on the loader in the routes HOT 5
- handleAnchor and `blob` links HOT 2
- [BUG] Error from cached load() is passed to the createAsync result as value HOT 2
- How do I listen for changes to `location.pathname`. HOT 2
- If a function wrapped in action throws some error it should be possible to catch it. HOT 20
- README has reference to `element` which no longer exists.
- <A> Component causes incorrect error message when used outside of a <Route /> HOT 3
- [Bug] MemoryRouter - `set()` can't change the page
- `useLocation().state` does not get updated on history back HOT 1
- [Bug?]: Unable to use `ErrorBoundary` when throwing Error from cached function in combination with `load` HOT 5
- action always trigger on form submit
- Slow performance matching route with localeCompare HOT 2
- Route load results in inconsistent revalidation behaviour HOT 2
- Why not just export useRouter and useRoute? HOT 2
- Error: <A> and 'use' router primitives can be only used inside a Route. HOT 3
- SSR no matching exports
- location.state undefined with HashRouter on v0.13.3 HOT 4
- useIsRouting returning true from SSR and causing Suspense issues HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from solid-router.