bigsexy
bigsexy
TTCTheo's Typesafe Cult
Created by bigsexy on 5/16/2024 in #questions
quick Graphite.dev question about existing commits
I'm try out graphite atm and i have an existing feature branch, main -> A with some well organized commits A.1, A.2, A.3, A.4 That i would love to just create a stacked diff for each commit, ontop of a new branch in my existing trunk. trunk -> A_1 -> A_2 -> A_3 -> A_4 Anybody know if this possible? What i've been doing is: cherry-picking to trunk, un-comitting, and re-comitting with graphite. A lil tedious, and it's annoying having to copy commit message/bodies. I've also been looking at sappling and ghstack, graphite seems more like designed for teams and not lone contributers just tryna make better PR's
1 replies
TTCTheo's Typesafe Cult
Created by bigsexy on 10/19/2022 in #questions
What is the difference between NextAuth and a SaaS solution for auth like firebase or supabase?
Just wondering why i ever wouldnt want to use NextAuth.
4 replies
TTCTheo's Typesafe Cult
Created by bigsexy on 9/23/2022 in #questions
Does a react Context component with a provider only get mounted when the provider is mounted?
ie does the code inside of say FooProvider
// ./FooContext.tsx
const FooContext = useContext()
export const FooProvider = () => {
...
return (
<FooContext.Provider value={...}>
{children}
</FooContext.Provider>
)
}
// ./FooContext.tsx
const FooContext = useContext()
export const FooProvider = () => {
...
return (
<FooContext.Provider value={...}>
{children}
</FooContext.Provider>
)
}
only get ran whenever i use the provider somehwere in my App
// ./SomeRandomComponent.tsx
import {FooProvider} from "./FooContext.tsx"
const SomeRandomComponent = () => {
...
return (
<FooProvider>
...
</FooProvider>
)
}
// ./SomeRandomComponent.tsx
import {FooProvider} from "./FooContext.tsx"
const SomeRandomComponent = () => {
...
return (
<FooProvider>
...
</FooProvider>
)
}
4 replies
TTCTheo's Typesafe Cult
Created by bigsexy on 9/23/2022 in #questions
rules of hooks question
17 replies
TTCTheo's Typesafe Cult
Created by bigsexy on 9/22/2022 in #questions
useQuery param is undefined. but query is enabled only if the param is defined.
14 replies
TTCTheo's Typesafe Cult
Created by bigsexy on 9/21/2022 in #questions
Deciding where to do searching & filtering. Frontend or Backend.
So i have a table in my DB called "Exercises". Which contain about 5 feilds of text data. In total there are about 1700 exercises. Currently im populating about 300 Exercises in my db for dev purposes. So it was easy enough to have an api route to pull every Exercises into the client (~77kb). And do some basic filtering client-side with some string pattern matching. This worked fine for now and it was not too much for my phone (primarily a mobile site im working on). With occasionally lag. But ive really enjoyed how snappy the feedback is since im not making search request over the wire to get the results. However, im thinking of completely populating the database with the full 1700 entries, and that will for sure shit on my phone when doing the naive for loop filtering. So i spent last night setting up full text search on pgsql to work with prisma to do the filtering on server side. But im affraid of losing that instant response as im typing in the search bar. Ideally, i would like to have both, the small payload of only receiving the data the matches the search term down the wire, and being able to search through exercises with instant feedback. I was thinking of pulling in about ~100 exercises on page load (say useQuery(['exercises', {take: 100}]) and then when a "search" is done, via useQuery(['exercises.get_by_search', {search_term: "foobar"}]) optimistically push the query data for 'exercises' with the data from the search with a setQueryData. but then this means ill be doing double filtering, unless i completely remove any client side search filtering. Alternatively i could use a library like https://github.com/nextapps-de/flexsearch https://github.com/lucaong/minisearch and completely skip doing any postgres fts, and just incrementally do useQuery(['exercises', {take: 100}]) whenever a search is performed and no matches are found. But this isnt very smart since its possible there are no matches.
26 replies
TTCTheo's Typesafe Cult
Created by bigsexy on 9/20/2022 in #questions
Simple postgreSQL question (or maybe its generic sql idk)
any postgres gigachads in here? or maybe this is in plain sql too. but what is the different between these two
select id, force, name, "equipment_name"
from "Exercise"
where
(to_tsvector(name) || to_tsvector(force))
@@
to_tsquery('pull | seated')
select id, force, name, "equipment_name"
from "Exercise"
where
(to_tsvector(name) || to_tsvector(force))
@@
to_tsquery('pull | seated')
and
select id, force, name, "equipment_name"
from "Exercise"
where
to_tsvector(name || ' ' || force)
@@
to_tsquery('pull | seated')
select id, force, name, "equipment_name"
from "Exercise"
where
to_tsvector(name || ' ' || force)
@@
to_tsquery('pull | seated')
in particular line 4
2 replies