luis_llanes
TTCTheo's Typesafe Cult
•Created by Oudwin on 1/5/2025 in #questions
LF Video where Theo talks about using react query for ping
With that, you could show some UI while the devices are connecting, then show a toast if the connection completed correctly or failed.
8 replies
TTCTheo's Typesafe Cult
•Created by Oudwin on 1/5/2025 in #questions
LF Video where Theo talks about using react query for ping
Yes that’s true, as long as you pass an async function you’re good, whatever that async function does won’t matter to React Query.
Just by doing that now you have control over the lifecycle of the async function by appending methods (onMutate, onSuccess, onError, onSettled) and the state by just calling the hook in your component
8 replies
TTCTheo's Typesafe Cult
•Created by FleetAdmiralJakob 🗕 🗗 🗙 on 1/6/2025 in #questions
Nuqs slower than useStste
First thing, have in mind that in dev mode everything is slower.
I assume that changing the URL to append the searchParams is triggering the page to be re-rendered on the server when it’s not needed.
Nuqs should sync to the URL with a react state AFAIK, if it's triggering the page to re-render maybe it's not the library fault
10 replies
TTCTheo's Typesafe Cult
•Created by Oudwin on 1/5/2025 in #questions
LF Video where Theo talks about using react query for ping
Connecting to external devices isn’t a synchronous task, JavaScript can’t know when the connection is going to be established, so React Query definitely helps with that and with managing all the lifecycle of the async operation
8 replies
TTCTheo's Typesafe Cult
•Created by Oudwin on 1/5/2025 in #questions
LF Video where Theo talks about using react query for ping
React Query handles async functions and keeps track of all the internal state of them (error, loading, data, etc)
8 replies
TTCTheo's Typesafe Cult
•Created by showduhtung on 12/27/2024 in #questions
how to pass searchParams around in next app server components?
I’ve been there, I tried to make my whole app a server components app because it was the new shiny thing and it meant less JavaScript on the client, blah blah blah.
At the end the power of React lies on the Composition, you don’t need your whole app to be either Server Components or Client Components, composition lets you mix and match, however it’s convenient.
If there’s a solved and trusted solution in the client side then go for it, use the server for the data loading and prefetching, and the client for the stuff React has been doing for years
13 replies
TTCTheo's Typesafe Cult
•Created by showduhtung on 12/27/2024 in #questions
how to pass searchParams around in next app server components?
Using client components doesn’t mean you’re giving up the cool things about the server. You can still pre-render the client components on the server, in fact, that’s what Next.js does (both client and server components are rendered on the server for the first render).
Also, you’re not giving up the loading states, if the operation is asynchronous you can use the “use()” API (React 19 tho) to unwrap a promise and it’ll continue to work just as fine, <Suspense> gets trigger
13 replies
TTCTheo's Typesafe Cult
•Created by I'm Not An Engineer on 12/28/2024 in #questions
Are Serverless functions the right thing for me?
As far as I know, Vercel takes care of the infrastructure no matter what Tool you use on the front end. It provides a CDN worldwide.
It happens to fit better with Next.js since they built it
24 replies
TTCTheo's Typesafe Cult
•Created by FleetAdmiralJakob 🗕 🗗 🗙 on 12/27/2024 in #questions
use(props.params) vs useParams() in Client Component in Next.js
And I would even say useParams is better. Passing the promise from the server component to the client component involves a network boundary, which is “invisible” to us but data must move between the server and the client through the network.
The useParams() must implement its internal logic in an optimal way since it was especially created for that purpose
14 replies
TTCTheo's Typesafe Cult
•Created by FleetAdmiralJakob 🗕 🗗 🗙 on 12/27/2024 in #questions
use(props.params) vs useParams() in Client Component in Next.js
Unless you dig into the implementation details of “useParams()” you’ll see if it saves a render or not, maybe it’s implementing the same logic under the hood and they literally work the same, but who knows.
Also, a rerender isn’t much of a problem, it’ll just commit once which is the heavy duty for the browser most of the time, re-render doesn’t mean “re-create the DOM elements” it means “just read the component logic again and decide whether or not to commit again”, and it might not commit again since it’s the same tree… unless it’s not the same tree due to the implementation details of the “useParams()” hook
14 replies
TTCTheo's Typesafe Cult
•Created by luis_llanes on 4/23/2024 in #questions
(windows 11) alias for pnpm doesn’t work in VS code
I figured it out. I'll share what I did in case you need it sometime or anyone else runs into this annoying set up
I ended up doing this:
"terminal.integrated.profiles.windows": {
"PowerShell": {
"source": "PowerShell",
"args": ["-NoExit", "-Command", "& Set-Alias -Name pn -Value pnpm"]
},
"Git Bash": {
"source": "Git Bash",
"args": ["--login"]
}
},
For the powershell terminal I had to pass the alias directly into the command that will execute every time i open a new terminal.. That was the only way I made it work.
For the GitBash, I could just tell VSCode to run the user profile everytime with "--login" (references "C:\Users\USERNAME.bashrc" It's where my alias is defined). For more info you can check this reference https://stackoverflow.com/questions/37104273/how-to-set-aliases-in-git-bash-for-windows
11 replies
TTCTheo's Typesafe Cult
•Created by luis_llanes on 4/23/2024 in #questions
(windows 11) alias for pnpm doesn’t work in VS code
Yes, I wanted to set powershell as it is the default but I’ll rather set up bash instead. Thank you!
11 replies
TTCTheo's Typesafe Cult
•Created by luis_llanes on 4/23/2024 in #questions
(windows 11) alias for pnpm doesn’t work in VS code
IT RUNS BUT IT DOESN'T SET THE ALIAS.
>>>setting.json in VScode
"terminal.integrated.defaultProfile.windows": "PowerShell",
"terminal.integrated.profiles.windows": {
"PowerShell": {
"source": "PowerShell",
"args": [
"-NoExit",
"-Command",
"& 'C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1'"
]
},
}
That's supposed to run the script where i define the alias, It does, and I know it because This is the script and the echo runs eberytime i open a new terminal in vs code
>>>>profile.ps1
Set-Alias -Name pn -Value pnpm
echo "Hello from profile.ps1 | alias should be set up"
11 replies
TTCTheo's Typesafe Cult
•Created by luis_llanes on 4/23/2024 in #questions
(windows 11) alias for pnpm doesn’t work in VS code
Update: still can't make it work. I've tried many different settings.json configurations but none seem to work.
I've tried following this guide https://code.visualstudio.com/docs/terminal/profiles#:~:text=To%20add%20Windows%20PowerShell%20as,set%20it%20as%20your%20default.
:c
11 replies
TTCTheo's Typesafe Cult
•Created by luis_llanes on 4/23/2024 in #questions
(windows 11) alias for pnpm doesn’t work in VS code
Ohh didn’t know by default the vs code terminal was running a different profile, yes, that might be it, I’ll check that thank you!
11 replies