Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@steven-tey
Copy link
Collaborator

@steven-tey steven-tey commented Nov 14, 2025

Summary by CodeRabbit

  • Bug Fixes
    • Improved deeplink routing to use the complete request path, resulting in more accurate redirects for deeplink interstitial flows and fewer incorrect destination paths. No other functional or public-interface changes were introduced.

@steven-tey steven-tey requested a review from devkiran November 14, 2025 05:46
@vercel
Copy link
Contributor

vercel bot commented Nov 14, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
dub Ready Ready Preview Nov 14, 2025 5:51am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 14, 2025

Walkthrough

The LinkMiddleware now extracts fullPath from the parsed request and constructs deeplink redirect URLs using /deeplink/${domain}${fullPath} instead of an encoded key-based path.

Changes

Cohort / File(s) Change Summary
LinkMiddleware Deeplink URL Construction
apps/web/lib/middleware/link.ts
Extracts fullPath from the parsed request and updates deeplink redirect URL construction to use /deeplink/${domain}${fullPath} instead of /deeplink/${domain}/${encodeURIComponent(key)}.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant WebServer
    participant LinkMiddleware
    participant Router

    Client->>WebServer: HTTP request (/.../some/path)
    WebServer->>LinkMiddleware: pass request
    LinkMiddleware->>LinkMiddleware: parse request -> domain, fullPath
    LinkMiddleware->>Router: redirect to /deeplink/{domain}{fullPath}
    Router->>Client: 302 Redirect to /deeplink/{domain}{fullPath}
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Single-file change focused on URL construction.
  • Check fullPath extraction correctness and encoding/edge-case handling (trailing slashes, query strings, fragment).
  • Validate existing deeplink route handlers accept the new path shape.

Possibly related PRs

Poem

🐰 I hopped through routes both short and long,
Replaced a tiny key with a whole-path song.
Now deeplinks stride where fullPath leads,
Hopping to /deeplink/{domain}{fullPath} with speed. ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add support for query parameter passing to deep links' accurately describes the main change: updating the LinkMiddleware to use the full request path (which includes query parameters) instead of just the encoded key for deeplink redirect URLs.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch deeplink-queryparam-passing

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1895c99 and 3e39d07.

📒 Files selected for processing (1)
  • apps/web/lib/middleware/link.ts (2 hunks)
🔇 Additional comments (3)
apps/web/lib/middleware/link.ts (3)

436-436: Verify URL encoding behavior with the new fullPath approach.

The previous implementation used encodeURIComponent(key), but the new code uses fullPath directly. While the URL constructor should handle this correctly, ensure that:

  1. Special characters in query parameter values are properly encoded
  2. Multiple query parameters are preserved correctly
  3. Edge cases like # fragments, spaces, and unicode characters work as expected

Consider testing with these query parameter scenarios:

  • Simple: /key?foo=bar
  • Multiple params: /key?foo=bar&baz=qux
  • Special chars: /key?redirect=https://example.com&message=hello world
  • Unicode: /key?text=你好
  • Fragments: /key?foo=bar#section

42-42: Verification confirms fullPath format is correct.

The parse() function constructs fullPath as ${path}${searchParamsString} where:

  • path from req.nextUrl.pathname always includes a leading slash
  • searchParamsString is either ?params or empty string (properly formatted)
  • URL encoding is handled by Next.js URL API

This guarantees fullPath format like /key?param=value, so line 436 produces valid URLs like /deeplink/domain/key?param=value. The change is safe and correctly preserves query parameters.


436-436: No changes needed to the deeplink page component—the URL structure change is compatible.

The deeplink page at apps/web/app/app.dub.co/(deeplink)/deeplink/[domain]/[key]/page.tsx correctly handles the new URL structure. The route [domain]/[key] extracts parameters independently from query strings, so /deeplink/dub.co/abc123?utm=email works the same as before—params are {domain: "dub.co", key: "abc123"} with query params handled separately by Next.js. The change from encodeURIComponent(key) to fullPath is safe; fullPath preserves the original request path encoding and query parameters are maintained throughout the redirect.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@steven-tey
Copy link
Collaborator Author

@coderabbitai full review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 14, 2025

✅ Actions performed

Full review triggered.

@steven-tey steven-tey merged commit 9d290d0 into main Nov 14, 2025
8 of 9 checks passed
@steven-tey steven-tey deleted the deeplink-queryparam-passing branch November 14, 2025 06:11
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.

3 participants