Giter Club home page Giter Club logo

Comments (3)

rturnq avatar rturnq commented on May 27, 2024

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.

iamcco avatar iamcco commented on May 27, 2024

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.

ryansolid avatar ryansolid commented on May 27, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.