Debaucus
Explore posts from serversCDCloudflare Developers
•Created by Debaucus on 2/16/2024 in #pages-help
522 Error - Custom domain and www. won't redirect.
3 replies
TTCTheo's Typesafe Cult
•Created by Debaucus on 1/1/2024 in #questions
Handling large translation files. Load only when building an option?
I have a 2.2mb translation file, per language.
I have quickly noticed using
next-i18next
loads the whole file, of every translation, on every pageload.
I am using getStaticProps with ISR, so I believed I would generate all the pages with the languages intergrated into it, then only send the required needed data for that page (it being pre-translated now).
Is there a solution to this? I've tried Google/ChatGPT but I don't know how to word it in a way that gets me to an answer.2 replies
TTCTheo's Typesafe Cult
•Created by Debaucus on 8/19/2023 in #questions
Database Table Design/Layout for Analytics type data?
I am looking to store views and clicks, with the possibility of other types of data moving into the future.
I understand a rough idea, but can't quiet comprehend the best way to layout this data. There are lots of ways to do it, but whats the right way?
Googling hasn't helped me find much of any use.
I could:
- Create a column labelled 1-365, then store the data for that day, keep a year per user
While this makes sense in my head, and would work, this doesn't scale long term if I want more than one year of data, and would also take a lot of space on day 1 of a new user with 364 0's for the sake of it.
I would also need to store a start date, then calculate any functions from that start date, also seems off.
I'm not asking for a 'explain everything' answer, but guidance to internet resources where I could learn how this SHOULD be done, rather then whatever works.
Thanks!
2 replies
TTCTheo's Typesafe Cult
•Created by Debaucus on 7/30/2023 in #questions
Looking for NextAuth Discord Refresh token rotation examples. All mine have expired.
I have created a project that uses Discord as a provider.
My
refresh_token
and access_token
's have expired, I've noticed when sign in is performed, it doesn't automatically refresh these details and thus access to oauth with Discord has dropped.
I am looking for an implementation that updates these details on signIn. I've found the Google example on the NextAuth (https://authjs.dev/guides/basics/refresh-token-rotation) guide but as it only includes Google and I'm not the brightest, I am looking to do Discord but do it correctly, as login is not something to mess up!
Thanks anyone who can help me out 😄8 replies
TRPC -useInfiniteQuery() refreshes all data when an input is varied, how to use?
So I have a TRPC infiniteQuery:
As an example, for each 3 gathered, I increase the value of page by 1, when
page = 2
, the page does a query, resets the pages content and triggers a repeating loop of queries.
I want to pass a varying value, be it string or number, to the query and be able to continue from the old content. Any help is welcome16 replies
TTCTheo's Typesafe Cult
•Created by Debaucus on 7/4/2023 in #questions
TRPC -useInfiniteQuery() refreshes all data when an input is varied, how to use?
So I have a TRPC infiniteQuery:
As an example, for each 3 gathered, I increase the value of page by 1, when
page = 2
, the page does a query, resets the pages content and triggers a repeating loop of queries.
I want to pass a varying value, be it string or number, to the query and be able to continue from the old content. Any help is welcome3 replies
TTCTheo's Typesafe Cult
•Created by Debaucus on 6/28/2023 in #questions
Force page data fetch with TRPC? Edit form cacheing older data.
I have an edit form.
If a user creates edits, submits, then immediately returns to the page the data is cached and displays the old information. What is the correct policy for handling this issue?
6 replies
TTCTheo's Typesafe Cult
•Created by Debaucus on 6/21/2023 in #questions
Planetscale - New field with default(uuid) erroring out?
This is a new addition to my database, I can't seem to sync my planetscale database with this as it errors out, I also tried with
@unique
removed and with cuid()
.
Field 'apikey' doesn't have a default value (errno 1364) (sqlstate HY000) during query: insert into Server
Googling error with 'planetscale' doesn't help. Thier help support has nothing either.. HELP!5 replies
TTCTheo's Typesafe Cult
•Created by Debaucus on 6/16/2023 in #questions
With Planetscale (or others), what's the correct way to retroactively edit a prod database?
Noob question I don't know how to Google correctly.
Let's say I forgot to add a username field to the users portion of my database.
In Planetscale, you can't push a development branch to production without a default value if the field can't be null, for example.
Or, let's say I didn't have 'creation date' in one table, but now I need it and want to import it over.
I find it hard to wrap my head around how to do this correctly.
Any advice (or guides on YouTube or text) would be very helpful!
Thanks 👍
5 replies
TTCTheo's Typesafe Cult
•Created by Debaucus on 5/31/2023 in #questions
Change ctx.session.user values to include new ones? Bad idea?
Right now when using
ctx.session.user
I get a few default options that come with t3-app.
.id
, .name?
, .image?
and .email?
. Is there a way to change this to include new values? I can't find an obvious spot or I am being silly.5 replies
TTCTheo's Typesafe Cult
•Created by Debaucus on 4/4/2023 in #questions
@unqiue in Prisma Schema. With mySQL/Planetscale, does case sensitivity matter?
Lets take a standard
I understand from reading up (I think at least) that mySQL doesn't care for case sensitivity when using a select query. But what about when inserting data?
Does
Debaucus
match the same way that debaucus
does? Because that would lead to issues with usernames and being unique.
If that is correct, the unique doesn't cover this edge case, how do you rectify this issue?4 replies
TTCTheo's Typesafe Cult
•Created by Debaucus on 4/2/2023 in #questions
tRPC prefetching URL slower? - What am I doing wrong here.
I've been toying with ISR attempts, failing, so moved back and am going step by step.
During testing, I tried (and by the loading page details of the JSON) succeeded! The pre-fetched data is there! However, the page is 30% slower in lighthouse!
Am I doing this wrong? The goal is to eventually have it cached for SEO purposes, so pre-fetch of just the query isn't quiet there yet.
17 replies
TTCTheo's Typesafe Cult
•Created by Debaucus on 3/31/2023 in #questions
tRPC query 'train'. what's the correct method to grab data from multiple sources?
I'm going to make an example as I'm either struggling to understand or am building my database wrong.
A user has a profile page, to load this profile page we use the URL value.
So I query tRPC when the username is entered into the URL /profile/Debaucus
I now get back the details for Debaucus, it's a real page.
Next, I want to query all the users posts, stored in a separate table, called posts.
If I make a new tRPC query, I get the 'too many re-renders' as I am doing multiple chains, as I am using the ID recovered from the first query in the second
Load page > use slug for tRPC query to get data > use that data to tRPC query more data?
Is this incorrect methodology?
13 replies
TTCTheo's Typesafe Cult
•Created by Debaucus on 3/23/2023 in #questions
Scalar lists but on Planetscale?
After starting to watch the tutorial posted day, I bit the bullet and am going to give planetscale a try!
I use 2 scalar lists in my current setup to store an array of tags for posts. These don't work on planetscale.
Database experts (or simply not a noob like me!) What is the best alternative to use?
1 replies
TTCTheo's Typesafe Cult
•Created by Debaucus on 3/18/2023 in #questions
.upsert when no way to track query/track unique identifier?
I have a (plan to) setup where a user can like multiple posts. This can be done once per day.
Here is my structure, my logic being that I can query the
where: { serverID, userID}
and get the results of previous.
Here's where I am misunderstanding, upsert
only allows for one where
entry? But I would need to query both in order to verify the correct entry.
This is the error I get inside VSCode:
5 replies
TTCTheo's Typesafe Cult
•Created by Debaucus on 3/15/2023 in #questions
Prisma Docs not working as instructed for insensitive case search. 9am and my brain hurts.
I am using the input of a URL to then query my database, so for example
Discord
. This works correctly, however it doesn't work for lower case, such as discord
.
Looking at the Prisma docs (https://www.prisma.io/docs/concepts/components/prisma-client/case-sensitivity) it instructs me to to use mode: 'insensitive',
. This does not work and the TypeScript error is as follows when placing the code under has: input,
I believe this is telling me because I don't have a mode
in the database, it can't be used. Which makes sense? But then what is the correct way to filter case insensitive?18 replies
TTCTheo's Typesafe Cult
•Created by Debaucus on 3/11/2023 in #questions
[Noob] Not understanding how to create an edit form.
I have 2 major questions/problems, full noob to thank you for any guidance.
I am trying to create an edit form for already submitted data, profile related data like username, description etc. During this process, a user picks a URL choice.
The edit form is using the same base, with some removed. This includes
slug
being removed.
This is where my questions begin:
1) Because Slug is required, I was getting issues where the default value being loaded in doesn't really work. I am struggling to understand how I load in the data for an edit form to then be re-submitted. Any examples of correct ways to load in data on a page to then be re-submitted?
2) When submiting data during testing, I would get errors related to slug not being included, or already being added. I am using mutate inside trpc so I am again feeling like I am missing some understanding.
Thank you!23 replies
CDCloudflare Developers
•Created by Debaucus on 1/29/2023 in #pages-help
Google Webmasters Authentication Nuked my settings. Help!
I setup Cloudflare pages and everything was working correctly with a custom domain.
I added my website to Google Webmasters which updates once of my cname records, in doing so it has stopped my website being able to be resolved. What are my records supposed to look like so I can fix this?
10 replies
TTCTheo's Typesafe Cult
•Created by Debaucus on 1/10/2023 in #questions
TRPC Server Side verification of action.
I have a button that can only be pressed once a day (as a vote). I've made it so the button turns to
disabled
when a vote has already been processed, or a click for the day.
I've read previously never trust the client, so are there any additional steps/best practices I should take in order to stop abuse?
My mind leads towards doing a check query whenever a button press is handled, but unsure.
5 replies