T
TanStack2w ago
extended-salmon

Expected component re-render behaviour on search params change

Hey everyone, I’ve got a question about navigation and component re-renders in TanStack Start. In one of my routes I have three components: 1. A button that adds a search param (e.g. page=2) using navigation function returned by useNavigate hook 2. A component that displays the current page search param. I get the value by using useSearch hook. 3. A component that doesn’t use any route hooks (just a plain component) When I click the button to update the search param, the whole app re-renders including the component no 3. Is this expected? My understanding is that only components that read search params using useSearch should re-render, not the entire app. Am I missing something? Thanks in advance!
2 Replies
correct-apricot
correct-apricot2w ago
probably you are subscribed to any other router state still somewhere up please provide a complete minimal example
extended-salmon
extended-salmonOP2w ago
So my understanding of mechanism is correct? Will check it out and send you a minimal example if i fail to figure out myself what is causing whole app to re-render. Thanks for quick response.

Did you find this page helpful?