Bryan3
Bryan3
Explore posts from servers
TTCTheo's Typesafe Cult
Created by Bryan3 on 8/25/2023 in #questions
TRPC vanilla client load failed when called on mobile browser
I ended up just doing everything using the default react query method. Did you figure out a fix?
6 replies
DTDrizzle Team
Created by Bryan3 on 9/29/2023 in #help
Delete operation in transaction sometimes not deleting row in database
I've found that I'm occasional getting this error in the Supabase postgres logs password authentication failed for user "postgres" Could this be causing the issue?
6 replies
DTDrizzle Team
Created by Bryan3 on 9/29/2023 in #help
Delete operation in transaction sometimes not deleting row in database
Currently patched the issue by checking if object exists after the deleting and deleting it again if it still exists
await db.transaction(async (tx) => {
// Update the organizationId of all related contacts to new id
await tx
.update(contact)
.set({ organizationId: input.newId })
.where(eq(contact.organizationId, input.id));
// Delete the organization with old id
data = await tx
.delete(organization)
.where(eq(organization.id, input.id))
.returning();
});

// check if organization still exists
const deletedOrg = await db
.select({ id: organization.id })
.from(organization)
.where(eq(organization.id, input.id));

// call delete again if can still find organization
if (deletedOrg[0] && deletedOrg[0].id === input.id) {
console.log("contact not deleted yet, deleting again");
await db
.delete(organization)
.where(eq(organization.id, input.id))
.returning();
}
await db.transaction(async (tx) => {
// Update the organizationId of all related contacts to new id
await tx
.update(contact)
.set({ organizationId: input.newId })
.where(eq(contact.organizationId, input.id));
// Delete the organization with old id
data = await tx
.delete(organization)
.where(eq(organization.id, input.id))
.returning();
});

// check if organization still exists
const deletedOrg = await db
.select({ id: organization.id })
.from(organization)
.where(eq(organization.id, input.id));

// call delete again if can still find organization
if (deletedOrg[0] && deletedOrg[0].id === input.id) {
console.log("contact not deleted yet, deleting again");
await db
.delete(organization)
.where(eq(organization.id, input.id))
.returning();
}
6 replies
DTDrizzle Team
Created by Bryan3 on 9/28/2023 in #help
How to include all fields in partial select syntax
Thanks, found it searching the earlier questions on the server
10 replies
DTDrizzle Team
Created by Bryan3 on 9/28/2023 in #help
How to include all fields in partial select syntax
10 replies
DTDrizzle Team
Created by Bryan3 on 9/28/2023 in #help
How to include all fields in partial select syntax
I used getTableColumns() to solve the issue
const { ...rest } = getTableColumns(contact);

const response = (await db
.select({
...rest,
organization: {
name: organization.name,
},
})
.from(contact)
.leftJoin(
organization,
eq(contact.organizationId, organization.id),
))
const { ...rest } = getTableColumns(contact);

const response = (await db
.select({
...rest,
organization: {
name: organization.name,
},
})
.from(contact)
.leftJoin(
organization,
eq(contact.organizationId, organization.id),
))
10 replies
TTCTheo's Typesafe Cult
Created by Bryan3 on 7/21/2023 in #questions
Backend equivalent to Create T3 App
Will try it out. Thanks for your help!
16 replies
TTCTheo's Typesafe Cult
Created by Bryan3 on 7/21/2023 in #questions
Backend equivalent to Create T3 App
Got it, would it be a good reason to choose Nest over Express or Fastify because of a more robust testing setup out of the box?
16 replies
TTCTheo's Typesafe Cult
Created by Bryan3 on 7/21/2023 in #questions
Backend equivalent to Create T3 App
Got it, any packages you would recommend installing on day one for back end?
16 replies
TTCTheo's Typesafe Cult
Created by Bryan3 on 11/25/2022 in #questions
How to display two divs in exact same position using tailwind
Will try it out, thanks!
3 replies
TTCTheo's Typesafe Cult
Created by Bryan3 on 11/19/2022 in #questions
How to trigger NextJS Image fetch again if not loaded in 3 seconds
not sure if the warning is actually preventing the FutureImage to be lazy loaded
15 replies
TTCTheo's Typesafe Cult
Created by Bryan3 on 11/19/2022 in #questions
How to trigger NextJS Image fetch again if not loaded in 3 seconds
Image with src "..." has a "loader" property that does not implement width. Please implement it or use the "unoptimized" property instead.
Read more: https://nextjs.org/docs/messages/next-image-missing-loader-width
Image with src "..." has a "loader" property that does not implement width. Please implement it or use the "unoptimized" property instead.
Read more: https://nextjs.org/docs/messages/next-image-missing-loader-width
15 replies
TTCTheo's Typesafe Cult
Created by Bryan3 on 11/19/2022 in #questions
How to trigger NextJS Image fetch again if not loaded in 3 seconds
But the console is giving me the following warning:
15 replies
TTCTheo's Typesafe Cult
Created by Bryan3 on 11/19/2022 in #questions
How to trigger NextJS Image fetch again if not loaded in 3 seconds
15 replies
TTCTheo's Typesafe Cult
Created by Bryan3 on 11/19/2022 in #questions
How to trigger NextJS Image fetch again if not loaded in 3 seconds
I added a custom loader just to use the lazy loading features following this thread
15 replies
TTCTheo's Typesafe Cult
Created by Bryan3 on 11/19/2022 in #questions
How to trigger NextJS Image fetch again if not loaded in 3 seconds
Not sure why that's happening but this is the image component
<FutureImage
key={`${loadCount}`}
src={imageURL}
loader={({ src }) => src}
alt="Image"
width={imageSize}
height={imageSize}
// onError={() => retryLoadOnError()}
// onLoadingComplete={() => clearMyTimeOut()}
/>
<FutureImage
key={`${loadCount}`}
src={imageURL}
loader={({ src }) => src}
alt="Image"
width={imageSize}
height={imageSize}
// onError={() => retryLoadOnError()}
// onLoadingComplete={() => clearMyTimeOut()}
/>
15 replies