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

fix: Try to fix unnecessary double-render #72

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

Conversation

rschristian
Copy link
Member

@rschristian rschristian commented Feb 26, 2025

Similar-ish to #69, #12 seems to cause a lot of unnecessary renders which @sbesh91 and I have been working out.

Not sure it's ideal but covers the simple cases anyhow. For the more complex, see comment below I suppose?

rschristian and others added 2 commits February 25, 2025 21:06
Co-authored-by: Steven Beshensky <s.beshensky@gmail.com>
@@ -157,12 +162,8 @@ export function Router(props) {
return true;
}
return false;
}, [url]);
}, [url, JSON.stringify(matchProps)]);
Copy link
Member Author

Choose a reason for hiding this comment

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

@JoviDeCroock Have any opinions on what we do here? Obviously JSON.stringify ain't ideal though I'm not sure if we want to start doing deep comparisons ourselves or with a dep either.

As the updated test cases show, your changes in #12 have us rendering routes more than we should which sets up a dependency on the user-passed props.

@rschristian rschristian marked this pull request as ready for review February 28, 2025 00:44
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.

1 participant