IceAge2OnDVD
IceAge2OnDVD
Explore posts from servers
TtRPC
Created by 2matto on 3/16/2024 in #❓-help
Where to put clean up code?
Looking to do the same with Neon DB, any updates?
7 replies
TtRPC
Created by IceAge2OnDVD on 9/8/2023 in #❓-help
Next cookies() not being set on Mutation in App Dir (T3 Turbo)
Managed to get it working, basically the answer is to avoid batchStreamLink on any routes/paths that need to set cookies.
export function TRPCReactProvider(props: {
children: React.ReactNode;
headers: Headers; // <-- Important
}) {
const [queryClient] = useState(() => new QueryClient());

const [trpcClient] = useState(() =>
api.createClient({
transformer,
links: [
unauthenticatedHandler,
loggerLink({
enabled: (opts) =>
process.env.NODE_ENV === "development" ||
(opts.direction === "down" && opts.result instanceof Error),
}),
splitLink({
condition(op) {
// Add logic here to return true for paths/routes that need to set cookies
return op.path.startsWith("auth.");
},
true: httpBatchLink({
url: getUrl(),
headers() {
const heads = new Map(props.headers);
heads.set("x-trpc-source", "react-no-stream");
return Object.fromEntries(heads);
},
}),
false: unstable_httpBatchStreamLink({
url: getUrl(),
headers() {
const heads = new Map(props.headers);
heads.set("x-trpc-source", "react-stream");
return Object.fromEntries(heads);
},
}),
}),
],
}),
);
export function TRPCReactProvider(props: {
children: React.ReactNode;
headers: Headers; // <-- Important
}) {
const [queryClient] = useState(() => new QueryClient());

const [trpcClient] = useState(() =>
api.createClient({
transformer,
links: [
unauthenticatedHandler,
loggerLink({
enabled: (opts) =>
process.env.NODE_ENV === "development" ||
(opts.direction === "down" && opts.result instanceof Error),
}),
splitLink({
condition(op) {
// Add logic here to return true for paths/routes that need to set cookies
return op.path.startsWith("auth.");
},
true: httpBatchLink({
url: getUrl(),
headers() {
const heads = new Map(props.headers);
heads.set("x-trpc-source", "react-no-stream");
return Object.fromEntries(heads);
},
}),
false: unstable_httpBatchStreamLink({
url: getUrl(),
headers() {
const heads = new Map(props.headers);
heads.set("x-trpc-source", "react-stream");
return Object.fromEntries(heads);
},
}),
}),
],
}),
);
19 replies
TtRPC
Created by IceAge2OnDVD on 9/8/2023 in #❓-help
Next cookies() not being set on Mutation in App Dir (T3 Turbo)
https://trpc.io/docs/client/links/splitLink , i'm going to have a look at using split links, see if that works
19 replies
TtRPC
Created by IceAge2OnDVD on 9/8/2023 in #❓-help
Next cookies() not being set on Mutation in App Dir (T3 Turbo)
is there a way you could make it so that certain mutations are never streamed? Like use a regular http link for certain routes
19 replies
TtRPC
Created by IceAge2OnDVD on 9/8/2023 in #❓-help
Next cookies() not being set on Mutation in App Dir (T3 Turbo)
makes sense
19 replies
TtRPC
Created by IceAge2OnDVD on 9/8/2023 in #❓-help
Next cookies() not being set on Mutation in App Dir (T3 Turbo)
Ahhh i see
19 replies
TtRPC
Created by IceAge2OnDVD on 9/8/2023 in #❓-help
Next cookies() not being set on Mutation in App Dir (T3 Turbo)
Is there on open issue for this?
19 replies
TtRPC
Created by IceAge2OnDVD on 9/8/2023 in #❓-help
Next cookies() not being set on Mutation in App Dir (T3 Turbo)
At least it doesn’t make sense to me
19 replies
TtRPC
Created by IceAge2OnDVD on 9/8/2023 in #❓-help
Next cookies() not being set on Mutation in App Dir (T3 Turbo)
I though that it may be something to do with not being able to set cookies after streaming starts, but then it doesn’t make sense how cookies work in query but not mutation
19 replies
TtRPC
Created by IceAge2OnDVD on 9/8/2023 in #❓-help
Next cookies() not being set on Mutation in App Dir (T3 Turbo)
Sorry for thing ping but I feel like I may need some more expert help on this @marminge
19 replies
DTDrizzle Team
Created by focused_morning on 8/23/2023 in #help
Invalid default value for 'updatedAt'
maybe im misremembering things
33 replies
DTDrizzle Team
Created by focused_morning on 8/23/2023 in #help
Invalid default value for 'updatedAt'
I recently updated drizzle for the first time in a month, and i think it must have been working at some point because I've been using drizzle in my codebase for a while
33 replies
DTDrizzle Team
Created by focused_morning on 8/23/2023 in #help
Invalid default value for 'updatedAt'
if you do this on a seperate branch then you shouldn't have data loss (hopefully)
33 replies
DTDrizzle Team
Created by focused_morning on 8/23/2023 in #help
Invalid default value for 'updatedAt'
So the fix for me was to comment out my whole schema.ts file, push to planetscale (just to drop all the tables), then apply the current_timestamp fix. For some reason this seemed to fix things
33 replies
DTDrizzle Team
Created by focused_morning on 8/23/2023 in #help
Invalid default value for 'updatedAt'
seems to be an issue introduced in more recent version, also was very fineky to fix. Had to push an empty schema to a development branch first before pushing the fix
33 replies
DTDrizzle Team
Created by focused_morning on 8/23/2023 in #help
Invalid default value for 'updatedAt'
managed to fix it by changing all my
timestamp("time").defaultNow()
timestamp("time").defaultNow()
to
timestamp("time").default(sql`current_timestamp()`)
timestamp("time").default(sql`current_timestamp()`)
33 replies
DTDrizzle Team
Created by focused_morning on 8/23/2023 in #help
Invalid default value for 'updatedAt'
Had this same issue today!
33 replies
TTCTheo's Typesafe Cult
Created by IceAge2OnDVD on 6/12/2023 in #questions
Whats going on with these type errors? (Challenge, TSPlayground Included)
cool learning expereince for me though
13 replies
TTCTheo's Typesafe Cult
Created by IceAge2OnDVD on 6/12/2023 in #questions
Whats going on with these type errors? (Challenge, TSPlayground Included)
shame that i don't even really need this bc I just discovered that my database ORM can do this me 🤦‍♂️
13 replies
TTCTheo's Typesafe Cult
Created by IceAge2OnDVD on 6/12/2023 in #questions
Whats going on with these type errors? (Challenge, TSPlayground Included)
its a fun challenge
13 replies