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

feat: Adds scope prop to LocationProvider, limiting link intercepts #42

Merged
merged 6 commits into from
Oct 17, 2024

Conversation

rschristian
Copy link
Member

@rschristian rschristian commented Oct 14, 2024

Closes #34

Allows users to opt-out of link interception, setting a string & regexp scope that intercepts should be limited to, e.g., <LocationProvider scope="/app"> will ignore clicks to /site.

@rschristian rschristian changed the title Feat/limit feat: Adds limit prop to LocationProvider, limiting link intercepts Oct 14, 2024
README.md Outdated
@@ -82,6 +82,10 @@ export async function prerender(data) {

A context provider that provides the current location to its children. This is required for the router to function.

Props:

- `limit?: string | RegExp` - Sets a limit on the paths that the router will handle (intercept). If a path does not match the limit, either by starting with the provided string or matching the RegExp, the router will ignore it and default browser navigation will apply.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name limit bothers me a bit, I would prefer something like include/exclude personally

Copy link
Member Author

@rschristian rschristian Oct 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, "include" means something quite different though. To include something is to have it be part of a whole; this limits the whole to only the matching value.

There's probably a better name somewhere (haven't yet found/thought of one myself), though I think "include" would give a very different idea than what we're going for. Just my initial thoughts though.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe scope? I'm not dead-set against include, can do it, though not my fav.

@rschristian rschristian changed the title feat: Adds limit prop to LocationProvider, limiting link intercepts feat: Adds scope prop to LocationProvider, limiting link intercepts Oct 16, 2024
@rschristian rschristian merged commit 6c4f217 into main Oct 17, 2024
1 check passed
@rschristian rschristian deleted the feat/limit branch October 17, 2024 07:56
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

Successfully merging this pull request may close these issues.

Restrict routing to a base path
2 participants