Knox
Explore posts from serversTTCTheo's Typesafe Cult
•Created by Knox on 6/24/2024 in #questions
Migrate react-scripts to vite
I have a project using react-scripts 4 with a proxy-dev-server needed to start the app where I have:
And I'm migrating the project to use vite. I have almost everything done, can start the app but can't start the session
My new vite.config.ts looks like this https://gist.github.com/FACorreiaa/3c87607cb52ee6a52d332b5b2a0875f9
And from the examples I saw I need to start my proxy and vite concurrently:
My server endpoint responds with json
https://127.0.0.1:8443/api/v2/system/status
status: "operational"
But when I try to start my session I get:
If I go back on the react-scripts configs everything works fine tho. Anyone has any clue on what I might be missing on the vite part ?
2 replies
TTCTheo's Typesafe Cult
•Created by Knox on 5/8/2024 in #questions
Migrating react-query v3 to tanstack-query v4
Im almost finishing this migration process
Right now the problem im having is on the getChanges function:
Deleting the undefined value solves this error highlighting but the fetch of the data fails.
Am I missing something ?
5 replies
TTCTheo's Typesafe Cult
•Created by Knox on 4/10/2024 in #questions
React Table v7 Sorting
I have a question regarding react-table v7, its not possible to have server side sorting with the table doing the handle the sorting, right ?
From what I see on the examples, if I have client side sort I can have the table take care of it, but If I want it to be server side I need to handle all the logic including function to sort, icons (ascend, descent) etc.
Right now I have server side pagination working but the sorting is still being handled by the table and what happens is that the sorting is only applied on the page itself (so for the first 40 elements, being 40 my limit).
Im pretty sure I need to do all the logic, I just wanted to avoid having extra work and style everything.
2 replies
TTCTheo's Typesafe Cult
•Created by Knox on 3/5/2024 in #questions
React query useInfiniteQuery (v3) and react table (v7) for server side pagination
Anyone has every connected react-query v3 with react-table v7 ? Im trying to implement a server side paginator with infinite scrolling doing:
And everything seems ok if I implement custom button paginators like:
but have weird behavior on the custom table paginator that react-table renders:
8 replies
TTCTheo's Typesafe Cult
•Created by Knox on 2/26/2024 in #questions
Cancel query when query value reaches to 0
Im making a query that returns me a set of values and that value with decrease over time till it reaches 0. I need to fetch every 100ms the query but I want to be able to cancel the query when outdatedObjects reaches 0.
3 replies
TTCTheo's Typesafe Cult
•Created by Knox on 12/20/2023 in #questions
Open id view content from Tanstack Table with Tanstack Router
Anyone has any tip how I can render a new view in the current page of a selected item ?
So im using tanstack table, query and router and if I want to open a new page when clicking an item and receiving that Item id, everything works wonderfully.
But my idea is to have a table and open a view next to it instead of on a new url page.
This open a new page inside the id with the router perfectly. But what if I want just to open a new component or view inside the same page ? Anyone has a tip for this ?
Any tip appreciated.
41 replies
TTCTheo's Typesafe Cult
•Created by Knox on 6/5/2023 in #questions
Image component not displaying images
Hey. So using NExtJS with the app directory, I have a card component with
Where the source of the card is this object:
Images is inside the public folder. Any tip on why the images aren't being rendered ?
3 replies
TTCTheo's Typesafe Cult
•Created by Knox on 3/29/2023 in #questions
Vite config with playwright-ct
on the project im working we are using absolute paths so..
~/folder/to/path
And im currently having this error:
`
Ive tried going through the simplest steps and following the documentation but so far nothing works when I run the tests.
This is my vite config (sorry, too much code)
https://pastebin.com/QtAGwZm1
This is my playwright-config:
https://pastebin.com/PQ9TyLZD
Any tip please?
1 replies
TTCTheo's Typesafe Cult
•Created by Knox on 3/27/2023 in #questions
Jotai migration from v1 to v2
Im trying to create an hook with useHydrateAtoms to reuse in different components:
And when using it on the component
Im getting this error:
Any tip?
1 replies
TTCTheo's Typesafe Cult
•Created by Knox on 3/21/2023 in #questions
Vite config with absolute paths
Im trying to make an e2e test for my components and im using absolute paths like
On my vite config I have this alias
And yet while running the test for a specific component i'm getting an error related to this absolute paths
Any idea ?
2 replies
TTCTheo's Typesafe Cult
•Created by Knox on 12/31/2022 in #questions
Get session data inside a mutation
Hello. So im trying to create a profile inside a user that is already logged in.
So the flow is Create User => Login => Create User Profile Inside the app.
My Models:
Im failing to understand how do I get the session that is logged .. or do I even need it ?
19 replies
TTCTheo's Typesafe Cult
•Created by Knox on 12/13/2022 in #questions
Credentials Provider session always return null
So im trying to make the login page work with email and password from the DB and when i click to submit the values im always having the session as null. This is what im doing:
So on my signin page i invoke the signIn method:
result returns:
5 replies
TTCTheo's Typesafe Cult
•Created by Knox on 12/10/2022 in #questions
Good idea to mix prisma and trpc on the [...nextauth].ts file or should call a function from
So I have something like this:
Its my first time using NextAuth and im thinking if doing something like this inside this file is a good idea or if this logic should be inside trpc method ?
Can anyone give me any tip / idea please?
2 replies
TTCTheo's Typesafe Cult
•Created by Knox on 12/8/2022 in #questions
i18next bold strings
Anyone has a better (working) solution for this ?
I basically want to pass the firstScore as bold but its not working this way or on the string itself
1 replies
TTCTheo's Typesafe Cult
•Created by Knox on 12/6/2022 in #questions
Sort imports
So using the create-t3-app im using the https://www.npmjs.com/package/eslint-plugin-simple-import-sort lib to sort my exports because it freaks me out to have these imports unsorted.
And i extended my eslint config as follows:
Yet the sort isnt working. Anyone ?
1 replies
TTCTheo's Typesafe Cult
•Created by Knox on 12/6/2022 in #questions
TypeError resolver is not a function at apiauthsession endpoint
Im trying to configure Google Credentials with the Google API to have the login working.
Ive put the URI redirect to http://localhost:3001/api/auth/callback/google (im using port 3001)
On my Signup button i have
on the nextAuth file:
Clicking the button tho will give me a
Kinda learning how this stack works and a bit blind on this one, if anyone has any tip would be greatly appreciated.
https://github.com/FACorreiaa/FitME
If anyone has 5mins to spare, im sure more experienced people with this stack could see what im doing wrong. tyvm
7 replies
TTCTheo's Typesafe Cult
•Created by Knox on 12/2/2022 in #questions
Type 'ZodObject{ id ZodNumber; first_name ... missing but required in _procedure
So im trying to pass the logic I had on my Nest + Prisma + GraphQL to the ct3 stack and im a beginner with trpc which makes it even more exciting!
The objective of my web application is to have a system where users can manage their workout and meal plans and, in case they dont have no idea of what they are doing, give them plan suggestions based on their weight, daily activity, etc.
I installed the package zod-prisma so i dont have to write everything by hand.
So based on my Prisma model i have
And on my user-login router I tought i could do something like:
Which i see now its not the right way to do. I probably have to read the documentation a bit better but i accept any tips to lead me on the right direction.
4 replies
TTCTheo's Typesafe Cult
•Created by Knox on 12/1/2022 in #questions
Adapt create t3 for mobile backend app?
Im building a fitness application right now with nest, prisma and graphql for my backend. Ive gotten highly interested in changing my code for this specific one. Im just wondering, i also want to adapt my endpoints to a mobile app in the future, ill think if i go native code or not.
From what i see in the code, this is not possible to do with create t3, right ? Since there aren't declared endpoins ? I saw tcrp can be extended to have declarative rest endpoints, but would this still be a good solution if one was thinking about building a mobile version of the web app in the future?
Would a mobile app be able to consume the server part of this mono repo ?
11 replies
TTCTheo's Typesafe Cult
•Created by Knox on 11/18/2022 in #questions
Graphql schema first or code first ?
Im currently building an app, for something i will use but as an hobby, using NestJS, GraphQL and Prisma. I have read about both approaches, and i find the schema first very interesting because it allows everyone to understand the API whatever language is used on the backend. Since im using Typescript and I will be working, I was wondering if the code first approach wouldn't make me write less code specially because Nest has a plugin that allows to not use decorators on every property, which makes the code cleaner. But I dont have enough Graphql experience to understand if with the schema first when i scale the app, if i will write alot more code or not. But i accept all the feedback.
28 replies