shikishikichangchang
shikishikichangchang
Explore posts from servers
TtRPC
Created by shikishikichangchang on 10/22/2024 in #❓-help
trpc version 11.0.0-rc.383 breaks turbo
I was seeing a MODULE_UNPARSEABLE error when running with the latest trpc rc. I did a bisect and found 11.0.0-rc.383 to be the breaking version. 11.0.0-rc.382 works fine. Only happens when running with next dev --turbo. next dev is fine
3 replies
TtRPC
Created by shikishikichangchang on 10/16/2024 in #❓-help
Trpc server actions
Are there any plans to bump server actions out from experimental? I like trpc a lot. But server actions being 'experimental' is a little worrying. Been looking at libraries like zsa and next-safe-action. Would like to stay with trpc.
8 replies
TtRPC
Created by shikishikichangchang on 10/9/2024 in #❓-help
Override output schema for certain mutations
Is it possible to overrider output schema's type for certain mutations? Currently I have a base procedure that has an outputschema as such:
import { z } from "zod";

const successSchema = z.object({
status: z.literal("success"),
data: z.any(),
});

const errorSchema = z.object({
status: z.literal("error"),
errorMessage: z.string(),
});

export const outputSchema = z.discriminatedUnion("status", [successSchema, errorSchema]);
export type Output = z.infer<typeof outputSchema>;
import { z } from "zod";

const successSchema = z.object({
status: z.literal("success"),
data: z.any(),
});

const errorSchema = z.object({
status: z.literal("error"),
errorMessage: z.string(),
});

export const outputSchema = z.discriminatedUnion("status", [successSchema, errorSchema]);
export type Output = z.infer<typeof outputSchema>;
As you can see, data is z.any(). For most mutations I don't need to return the data so that's not a problem. However, I want to return the data with the correct type for some. The output must have either z.literal("success") or z.literal("error"). I tried to add an extra '.output' but it seems like trpc only allows for one (no chaining to override).
3 replies
DTDrizzle Team
Created by shikishikichangchang on 6/9/2024 in #help
Turso SQLite vector search
4 replies
TTCTheo's Typesafe Cult
Created by shikishikichangchang on 4/10/2024 in #questions
trpc/react not working on AWS
No description
28 replies
TtRPC
Created by shikishikichangchang on 4/10/2024 in #❓-help
Unexpected token
Works fine locally, doesn't work when deployed to AWS via sst.dev. Was working last night. Redeployed the app today with no changes, started failing. Please help
8 replies
TtRPC
Created by shikishikichangchang on 3/29/2024 in #❓-help
keep previous data
Trpc 11 (trpc@next) doesn’t have support for keepPreviousData? I’m trying to useQuery with keepPreviousData but can’t be used
4 replies
TTCTheo's Typesafe Cult
Created by shikishikichangchang on 3/29/2024 in #questions
keep previous data
the latest t3 app doesn't support keepPreviousData in useQuery? App router, drizzlem, trpc setup.
2 replies
DTDrizzle Team
Created by shikishikichangchang on 3/29/2024 in #help
Is there a way in drizzle to return the count before limit and offset?
i have a table that i need to limit and offset that also needs to return the count. is there a way to do this using one query?
1 replies
DTDrizzle Team
Created by shikishikichangchang on 3/29/2024 in #help
order by dynamic colum
i have a table and i want the user to be able to order by different columns. how do i write the drizzle query to take in a string and do the ordering? Example here: https://orm.drizzle.team/learn/guides/limit-offset-pagination does ordereing as such: .orderBy(users.id). But for my use case, I won't know until runtime.
22 replies
TTCTheo's Typesafe Cult
Created by shikishikichangchang on 3/23/2024 in #questions
trpc query failing in prod
I'm using trpc's use query together with nextjs 14's server components. The useQuery is in a client component. Everything works perfectly locally, including the productino build. However when I deploy to AWS via sst, it starts failing. Any idea why? This is the error: SyntaxError: Unexpected non-whitespace character after JSON at position 2. It shows up in the browser console through loggerLink. When I inspect on the network tab, it does return the response with the right data. It seems like trpc on the front end isn't able to pass the right stuff to reavt to re-render? Upon checking the response in detail, I see that there's "62 bf" and "0" at the beginning and the end of the json response respectively. This only happens in the deployed version. Not even on the locla built version.
18 replies
TTCTheo's Typesafe Cult
Created by shikishikichangchang on 3/23/2024 in #questions
retry logic with server action
How do you implement retry logic with server action? I'm using next-safe-action if that matters.
3 replies
KPCKevin Powell - Community
Created by shikishikichangchang on 3/17/2024 in #front-end
Infinite, scrollable, animated link Cloud
How can I create a component like the one Perplexity has? I have the animation working but if I let the user scroll, the animation gets all messed up. The component needs to have “infinite” items (the one that disappears from the left appears from the right and vice versa), scrollable, and animated.
3 replies
TTCTheo's Typesafe Cult
Created by shikishikichangchang on 3/8/2024 in #questions
nextAuth v5
Has anyone been able to make it work? Tried it and keep getting Error [ERR_MODULE_NOT_FOUND]: Cannot find module
3 replies
DTDrizzle Team
Created by shikishikichangchang on 3/5/2024 in #help
auto create nanoid
How do I automatically create nanoid using Drizzle for Mysql/planetscale? similar to prisma's cuid.
1 replies
DTDrizzle Team
Created by shikishikichangchang on 3/3/2024 in #help
how can I truncate all tables in the new drizzle studio? Previously there was a drop down button
tsia
8 replies
DTDrizzle Team
Created by shikishikichangchang on 2/28/2024 in #help
nested relation
how can I query a model with 2 'with'? So query student with books, with pages, for example.
4 replies
TTCTheo's Typesafe Cult
Created by shikishikichangchang on 2/23/2024 in #questions
Weird cache behavior
I created a new t3 app with app router and trpc. Then I moved CrudShowCase (including the get posts part) to a new route. I realized a weird behavior after adding artificial delay to the get posts api. 1. On initial visit - fetch data from source and takes a while 2. On subsequent visits < 30s: instant page load due to cache 3. On first visit after 30s - fetch data from source and takes a while 4. All visits from here on - fetch data from source and takes a while. The discrepancy/unexpected outcome is 4. I thought 4 should be the same as 2, in that the cache is reset to the 30s timer and the user would get instant page loads again. But that is not the case. Can someone confirm this is expected or non-expected behavior?
15 replies
TTCTheo's Typesafe Cult
Created by shikishikichangchang on 2/4/2024 in #questions
sensitive file
Is it safe to store a sensitive file in the src (not under "public") directory? Can't seem to find any docs on this. Basically I need that file when a function runs so I run this code: fs.readFileSync(path.join(process.cwd(), "", "sensitiveFile.text"));
6 replies
DTDrizzle Team
Created by shikishikichangchang on 11/24/2023 in #help
mysql on delete cascase
Seems like mysql with planetscale does not support "reference". Is there a way to on delete cascase or do I have to do it manually in a transaction?
3 replies