Ramsay
TTCTheo's Typesafe Cult
•Created by Ramsay on 7/12/2023 in #questions
How to view hsl colors in vscode
4 replies
TTCTheo's Typesafe Cult
•Created by Ramsay on 7/6/2023 in #questions
NextAuth profile images broken
I'm using Spotify as a provider with NextAuth, and after a few months or so, the profile images break. The link to the profile image in my db returns a 404 as Spotify changes the url for the profile images for some reason. A few other providers have this issue as well. I remember seeing an issue in the NextAuth repo that provided some potential solutions you can do to solve this but I can't find it. Does anyone have any recommendations on how to fix this issue?
1 replies
TTCTheo's Typesafe Cult
•Created by Ramsay on 4/15/2023 in #questions
Trouble with async validation using React Hook Form
I have a form in my app where a user can enter info for a song. One of the fields is for the spotify url of the song. I made a trpc procedure to get the track info from the spotify url. So if the user pastes the spotify url in the form, it will trigger my query to load the track info, and then I autofill the other form values with the loaded track info. If the query fails, I want the spotify url field to show an error message. I tried to do this by calling
setError
when the the query errors, but this way, the user is still able to submit the form. It appears that the correct way to do this kind of async validation is to do the validation on the validate
option of the register method, but I don't know how I could wait for the query to finish in the validate function. Any ideas how I could achieve this experience?1 replies
TTCTheo's Typesafe Cult
•Created by Ramsay on 4/9/2023 in #questions
Should I create a trpc procedure for third party apis?
Should I be creating trpc procedures for calling third party apis, or should I just fetch them directly or use React Query by itself? For example, if I'm using the YouTube or Spotify search api in my app and doing nothing else with my db is it worth it to wrap this call into a procedure?
14 replies
TTCTheo's Typesafe Cult
•Created by Ramsay on 3/19/2023 in #questions
How to handle Prisma schema changes with PlanetScale
Feeling sooooo confused about what I thought should be a simple concept. I made a prisma schema change, just added a createdAt and updatedAt field to a model with the prisma
@default(now())
and @updatedAt
attributes. Then ran prisma db push
, then opened a deploy request on PlanetScale. PlanetScale said the deploy would be safe. Then tried to deploy and got an error that updatedAt is not nullable and has no default value. How can I fix this? Why did PlanetScale say the deploy would be safe if it didn't work? And what I some resources I can look at to learn more about this, because I'm sure I'll have more complex schema changes in the future.3 replies
TTCTheo's Typesafe Cult
•Created by Ramsay on 3/18/2023 in #questions
Prisma schema changes when moving from NextAuth to Clerk
With NextAuth I have a User schema that contains many relation fields. For example:
If I were to move to clerk and therefore no longer manage my users in my database, would I just have to delete the User model and then remove the relation in the Post like so?
and then adjust my procedures accordingly? Is this all I would have to do or are there other changes to keep in mind?
19 replies
TTCTheo's Typesafe Cult
•Created by Ramsay on 3/9/2023 in #questions
How to view your data in PlanetScale?
Is there really no table editor view, similar to Prisma Studio, in PlanetScale? I assume there is only access via the web console, which is kind of a bummer. Anyways I can't view my data in the web console. Following the directions here https://planetscale.com/docs/concepts/web-console, I entered SHOW TABLES; into the console. That gave me my list of tables. Then I ran DESCRIBE USERS; into the console, then it gave my an error that that table does not exist, even though it shows up in the results from SHOW TABLES;. What am I doing wrong here?
3 replies