Skip to content

Conversation

@ismamz
Copy link
Owner

@ismamz ismamz commented Dec 10, 2024

No description provided.

@vercel
Copy link

vercel bot commented Dec 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
next-transition-router ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 30, 2025 10:20pm

@ismamz ismamz linked an issue Dec 10, 2024 that may be closed by this pull request
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enables support for search parameters within the application by updating navigation logic and adding a dedicated component to track URL changes. Key changes include:

  • Integrating the useSearchParams hook and managing combined path/search state in TransitionRouter.
  • Introducing the SearchParamsHandler component wrapped in Suspense.
  • Updating demo page and back button components to reflect the new navigation behavior.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/context.tsx Added support for search parameters and updated navigation logic.
example/components/back.tsx Updated button text for improved clarity.
example/app/demo/page.tsx Modified page component to use async searchParams and enhance UI.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the transition router to be aware of URL search parameters and prevents unnecessary transitions when only query strings change, and updates the demo page to showcase pagination via searchParams.

  • Track full path including search parameters using a new SearchParamsHandler.
  • Skip transitions if only the query string matches the current URL.
  • Update example/demo page to accept searchParams, add pagination links, and use the new Back component.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/context.tsx Added SearchParamsHandler, state for full path, and adjusted navigation logic to consider search params.
example/components/back.tsx Updated back button label to include an arrow.
example/app/demo/page.tsx Made DemoPage async with searchParams, added pagination links, and used the Back component.
Comments suppressed due to low confidence (3)

src/context.tsx:10

  • The SearchParamsHandler uses useEffect but useEffect is not imported from React. Add useEffect to the import list.
import { useMemo, useRef, useState, Suspense, } from "react";

src/context.tsx:162

  • [nitpick] This new SearchParamsHandler logic for tracking query strings isn’t covered by existing tests. Add unit or integration tests to verify it updates pathWithSearch correctly when search params change.
function SearchParamsHandler({

src/context.tsx:150

  • [nitpick] The SearchParamsHandler component doesn’t suspend, so wrapping it in Suspense isn’t necessary. You can render it directly to simplify the tree.
<Suspense fallback={null}>

}
};
}, [stage, pathname]);
}, [stage, pathWithSearch]);
Copy link

Copilot AI May 30, 2025

Choose a reason for hiding this comment

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

The navigate callback lists pathWithSearch as a dependency but never uses it, and omits pathname. This may cause stale closures when the path changes. Adjust the dependency array to reflect the values used inside the callback.

Suggested change
}, [stage, pathWithSearch]);
}, [stage, pathname]);

Copilot uses AI. Check for mistakes.
@sndrgb
Copy link

sndrgb commented Aug 20, 2025

Hi @ismamz why this PR isn't merged yet? can I help you on something?

@ismamz
Copy link
Owner Author

ismamz commented Aug 21, 2025

Hi @ismamz why this PR isn't merged yet? can I help you on something?

Hi @sndrgb, I need to resolve a conflict and run some tests to make sure everything works properly. I'll try to have it done as soon as possible. If you can run some tests, that would be a great help!

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.

Search parameter support

3 participants