Remounting Select Statements
I have three selects that have a user select a category and subcategory before they can pick their item since the item list is over 9,000 items. Once the parent is selected I fetch the next layer of data using tanstack-query/solid. The issue is that the entire form (tanstack-form/solid) seems to get re-renderd since the screen flashes and the user is sent to the top of the page, although the focus stays on the select correctly.
Can someone help me understand how to prevent this from happening?
Code
2 Replies
You probably just miss a Suspense.
Problem is that the createMemo is eager (will be lazy in 2.0) which will trigger the Suspense above this component.
It seems that the memos are not really necessary in this use case as you call each of the memoed accessors only once. Try to remove the memos and have only functions and wrap each Select in a Suspense.
Thank you! I will try this and come back soon
that 100% fixed it. Thank you.