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: consider max depth when multiple placeholders are candidate #96

Merged
merged 3 commits into from
Mar 25, 2024

Conversation

pi0
Copy link
Member

@pi0 pi0 commented Mar 25, 2024

resolves #95 (context: nitrojs/nitro#2310)

The issue is original implementation considered there is one placeholder candidate on each level of tree (cached into placeholderChildNode). If there is more than one, we need to find the right candidate.

This PR fixes issue by assigning max depth to nodes when inserting and consider it when choosing the right candidate (it should have same remaining length of incoming request path)

(honestly this implementation is hacky, but for v1 we have no choice until fully rewrite in v2)

@pi0 pi0 merged commit 56a908e into v1 Mar 25, 2024
2 checks passed
@pi0 pi0 deleted the fix/multi-wild branch March 25, 2024 15:38
pi0 added a commit that referenced this pull request Jul 3, 2024
@pi0 pi0 mentioned this pull request Jul 3, 2024
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.

Nested placeholder conflicts with sibling patterns
1 participant