Replies: 1 comment
-
|
Maybe a minor addition to the search params part. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi folks,
I got a pretty widespread question which is maybe also a share your structure or docs page type of question.
My Setup: I use Tanstack Start and Tanstack Query (and a lot of other packages, which are not important here).
What am I trying to find out: How to properly setup my structure regarding data fetching and caching with start + query. I already read through most of query, router and start docs but I find it difficult to understand a clear approach on how do to it.
I got a separate API which provides a openapi json and from there I generate with heyApi types, zod schemas for DTOs, fetch methods and query helpers (https://heyapi.dev/).
General Structure in my App. is I have a overview page and a detail page. All in the context of a ticketing platform (https://app.nono-events.de)
Example: Discount/Coupon feature:
I have the following:
Now I use this for the overview page to show a list of discounts. In the details I have a endpoint to fetch the discount details and then a list of discount usages.
The page for discount:
You see: I do search with validateSearch and the in the loader loading the data. In the component I then do the useSuspensequery and pass the final, always set data to the dedicated Page/Component.
For settings the queryParams I defined a hook to set the params for the paginated search. This isnt the most typesafe appraoch but with 50+ paginated routes I dont want to do that much repetetive work.
So to come to the end:
I am really thankful for any input/comment or a link for existing discussions/docs.
What I found:
#1563
Beta Was this translation helpful? Give feedback.
All reactions