Input box dynamically changing search params with out losing focus
My current implementation is causing a re-render of my input box on each key I type into the input box causing me to lose focus on that input box. Is there a pattern I can use to keep focus but still update my search params as I type.
15 Replies
genetic-orange•5mo ago
please provide a complete minimal example
conscious-sapphireOP•5mo ago
Let me know if it's not clear from the example. Thanks in advance 🙏
genetic-orange•5mo ago
cant reproduce
genetic-orange•5mo ago
Manuel Schiller
StackBlitz
Router Kitchen Sink File Based Example (forked) - StackBlitz
Run official live example code for Router Kitchen Sink File Based, created by Tanstack on StackBlitz
genetic-orange•5mo ago
doesnt lose focus
sensitive-blue•5mo ago
Is using the navigate function here going rerender the whole app, because it's happing for me
genetic-orange•5mo ago
where?
sensitive-blue•5mo ago
I mean, If I am using navigate({to: ".", search: ...}) on input change, is that supposed to rerender the whole app?
genetic-orange•5mo ago
no
it will rerender all components that are subscriber to router state that changes during said navigation
sensitive-blue•5mo ago
How do I know if a component is subscribing to the state ?
e.x the pagination is an isolated component but its being rerendered, I guess the main Route is doing that, that's why childrens are rerendering too.
genetic-orange•5mo ago
are you using some hook from router there?
like useRouterState
sensitive-blue•5mo ago
Nope, I added a debounce mechanism now, do you think the complete rerender is weird, I mean since the url is change it makes sens to rerender the parent Route ?
genetic-orange•5mo ago
give me a reproducer , otherwise no idea
sensitive-blue•5mo ago
Oh, I think I found why, beacuse Im using Route.useLoaderData(); and that's why the whole Route is rerendering
deep-jade•3mo ago
I have a same problem