Hussam
Explore posts from serversPPrisma
•Created by Hussam on 10/7/2024 in #help-and-questions
How can I fix the migration order (already applied in production)
While working in feature branches, it is difficult to maintain the order in which the migrations are applied.
Let's say we delete a table in the migration and there's another migration that modifies the column of this table. The migration that deletes the table occurs first(created) but gets applied after the modification of the column takes places.
While this works in production database, because edit column migration has already been applied at the time of applying deletio migration.
But this would fail if someone would try from an empty database, even generating prisma clent won't be possible as we get a error similar to
failed to apply cleanly to the shadow database.
2 replies
Suggested way to invalidate queries on a component that is used on multiple pages.
Please suggest me a way I can handle the following situation in the best possinle manner.
Coinsider a Component
- used in multiple pages
- has mutations, which requires query invalidation on other components of the page.
- the query invalidation differes from page to page, if we invalidate everything that will be waste of network request. - I dont always have the key to invalidate the cache
- the query invalidation differes from page to page, if we invalidate everything that will be waste of network request. - I dont always have the key to invalidate the cache
.invalidate({ id: input.id }) // input.id is not known
solutions tried
- conditionally do invalidtion based on route1 replies
The inferred type of this node exceeds the maximum length the compiler will serialize.
Hey, there I am running into this error when I have more than 12 routers in the mergeRouters function.
The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed.
version: latest
related: https://github.com/trpc/trpc/issues/2568 // that din't work for me.19 replies
How to infer types of a query
Coinsider the example
const hello = trpc.hello.useQuery();
I would like to export the type we get on hover(on hello).
I could only find how to infer the data type from the docs
const { data } = trpc.hello.useQuery()
https://trpc.io/docs/infer-types using inferRouterOutputs
The reason I am passing everything and not just data as props down to components, is because I want to access the loading, error states etc.6 replies