Gary, el Pingüino Artefacto
Gary, el Pingüino Artefacto
Explore posts from servers
DTDrizzle Team
Created by san4d on 4/11/2024 in #help
Parameterized Interval in Where Clause
:c
4 replies
DTDrizzle Team
Created by san4d on 4/11/2024 in #help
Parameterized Interval in Where Clause
Hi dude, did you manage to get this working?
4 replies
DTDrizzle Team
Created by Gary, el Pingüino Artefacto on 11/16/2024 in #help
Brand ids?
I tried mapping with extras props and the sql tag, but I read on github that there is a bug there the .mapWith is not called on extra props
9 replies
DTDrizzle Team
Created by Gary, el Pingüino Artefacto on 11/16/2024 in #help
Brand ids?
I tried this way but it doesn't work with the query API
9 replies
DTDrizzle Team
Created by Gary, el Pingüino Artefacto on 11/16/2024 in #help
Brand ids?
Also could something like
export const usersTable = pgTable("users", {
// Possible?
id: uuid().primaryKey().transform((value) => `users_${value}`),
createdAt: timestamp().notNull().defaultNow(),
givenName: varchar({ length: 64 }).notNull(),
familyName: varchar({ length: 64 }).notNull(),
})
export const usersTable = pgTable("users", {
// Possible?
id: uuid().primaryKey().transform((value) => `users_${value}`),
createdAt: timestamp().notNull().defaultNow(),
givenName: varchar({ length: 64 }).notNull(),
familyName: varchar({ length: 64 }).notNull(),
})
9 replies
TTCTheo's Typesafe Cult
Created by jalen21 on 10/25/2024 in #questions
Can I combo Tanstack query and Server component on Nextjs?
thats enought to get ssr working
35 replies
TTCTheo's Typesafe Cult
Created by jalen21 on 10/25/2024 in #questions
Can I combo Tanstack query and Server component on Nextjs?
i called makeQueryClient on the server and use a HydrationBoundary with the prefetch
35 replies
TTCTheo's Typesafe Cult
Created by jalen21 on 10/25/2024 in #questions
Can I combo Tanstack query and Server component on Nextjs?
"use client"

import type { ReactNode } from "react"
import { isServer, QueryClient, QueryClientProvider } from "@tanstack/react-query"
import { ReactQueryDevtools } from "@tanstack/react-query-devtools"

let browserQueryClient: QueryClient | undefined = undefined

function makeQueryClient() {
return new QueryClient({
defaultOptions: {
queries: {
staleTime: 1000 * 60,
gcTime: 1000 * 60 * 60 * 24,
},
mutations: {
onSuccess: async () => {
await browserQueryClient?.invalidateQueries()
},
},
},
})
}

function getQueryClient() {
if (isServer) {
return makeQueryClient()
} else {
if (!browserQueryClient) browserQueryClient = makeQueryClient()
return browserQueryClient
}
}

export function ReactQueryClientProvider(props: { children: ReactNode }) {
const queryClient = getQueryClient()
return (
<QueryClientProvider client={queryClient}>
{props.children}
<ReactQueryDevtools />
</QueryClientProvider>
)
}
"use client"

import type { ReactNode } from "react"
import { isServer, QueryClient, QueryClientProvider } from "@tanstack/react-query"
import { ReactQueryDevtools } from "@tanstack/react-query-devtools"

let browserQueryClient: QueryClient | undefined = undefined

function makeQueryClient() {
return new QueryClient({
defaultOptions: {
queries: {
staleTime: 1000 * 60,
gcTime: 1000 * 60 * 60 * 24,
},
mutations: {
onSuccess: async () => {
await browserQueryClient?.invalidateQueries()
},
},
},
})
}

function getQueryClient() {
if (isServer) {
return makeQueryClient()
} else {
if (!browserQueryClient) browserQueryClient = makeQueryClient()
return browserQueryClient
}
}

export function ReactQueryClientProvider(props: { children: ReactNode }) {
const queryClient = getQueryClient()
return (
<QueryClientProvider client={queryClient}>
{props.children}
<ReactQueryDevtools />
</QueryClientProvider>
)
}
35 replies
TTCTheo's Typesafe Cult
Created by jalen21 on 10/25/2024 in #questions
Can I combo Tanstack query and Server component on Nextjs?
this is mine
35 replies
TTCTheo's Typesafe Cult
Created by jalen21 on 10/25/2024 in #questions
Can I combo Tanstack query and Server component on Nextjs?
it will still be ssr if thats what you are asking
35 replies