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

order independent routing #250

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

liamqma
Copy link
Collaborator

@liamqma liamqma commented Jan 2, 2025

This PR adds order-independent matchRoute.

Copy link

Thank you for your submission! Like many open source projects, we ask that you sign our CLA (Contributor License Agreement) before we can accept your contribution.
If your email is listed below, please ensure that you sign the CLA with the same email address.

The following users still need to sign our CLA:
❌AtlassianRubberDuck

Already signed the CLA? To re-check, try refreshing the page.

Copy link

changeset-bot bot commented Jan 2, 2025

🦋 Changeset detected

Latest commit: db43d31

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
react-resource-router Minor

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

@liamqma liamqma force-pushed the order-independent-routing branch from fb382aa to ae11729 Compare January 2, 2025 05:26
@@ -0,0 +1,326 @@
import { pathToRegexp } from 'path-to-regexp';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we use .ts file extension for files in this directory?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ah, good point. Let me change it to .ts.

const hasOwnProperty = Object.prototype.hasOwnProperty;
const MAX_CACHE_SIZE = 1000;

function shallowEqual(objA: any, objB: any) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this a copied from somewhere? I remember seeing something similar already in the repo.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, it's a duplicate. I copied it because I want to keep the cache separate between the existing matchRoute and the order-independent matchRoute.
Thinking about it, I can create a factory function to avoid duplicated code. Let me do that.

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.

4 participants