Skip to content

Add the ability to redirect #75

@webJose

Description

@webJose

Motivation

As applications evolve, it is conceivable that URL's become obsolete. It is possible that users may have an old URL saved somewhere, perhaps in their Favorites bar in the browser. Application developers might very well account for this by registering somewhere a list of legacy URL's and the new URL to redirect the user.

Technical Details

I am thinking the best thing to do is to create a specialized (and simplified) router engine that, instead of matching all routes for the purposes of setting reactive content (used by routes to eventually mount user interface), will match for the purposes of immediately navigating to another URL. In this case and unlike the current behavior of the router engine, this specialization will stop matching routes as soon as one matches, and will immediately trigger navigation.

Consequences

I'm not sure. When actually redirecting in normal multi-page applications, the browser stops all JS execution and starts to load the new URL's content from the network.

In a PWA/SPA application, JS continues to execute. This means that routers and routes will probably attempt to do their thing on the original, obsolete URL, then they will repeat for the redirected URL.

I guess consumers of the library will just need to be aware of this fact and make sure that URL's being redirected never match current routes, so the PWA/SPA application doesn't "flash" content, since it is an ugly thing to see and have.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Priority: MediumMedium priority. Upvote to request a higher priority. Downvote to attempt to lower priority.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions