-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
feat: provide match function to allow the opposite of resolve #14997
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
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 2534e43 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
IMO this would also need to call the /**
* @param {string | URL} url
*/
export async function match(url) {
if (typeof url === 'string') {
url = new URL(url, location.href);
}
const intent = await get_navigation_intent(url);
if (intent) {
return {
id: intent.id,
params: intent.params
};
}
}On the server this might be a bit more tricky since this logic is scattered over almost 100 lines. |
9e9ab44 to
d02f58d
Compare
|
@PatrickG good call. I switched to that and added support for reroute server-side. Probably easiest to leave server as is rather than trying to abstract it away for this one use case? Sorry for not looking at this sooner. |
|
I've extracted the route matching into a new |
bd79003 to
2534e43
Compare
fixes #11746
Delightfully simple to add this as a feature!
Couple things I'm not sure of:
matchincludes endpoints. Is it more confusing to include them or is it better to exclude to maintain parity with client?generate:typesdoesn't addmatchtoindex.d.tsfor some reason. How do I can I get it to work?Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm testand lint the project withpnpm lintandpnpm checkChangesets
pnpm changesetand following the prompts. Changesets that add features should beminorand those that fix bugs should bepatch. Please prefix changeset messages withfeat:,fix:, orchore:.Edits