t
tRPC
t
tRPC
How to prevent tRPC api hook from auto-fetching on component load?
Original message was deleted
tRPC
Join
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,111
Members
View on Discord
๏ฟฝ
๐๐ฎ๐ฝ๐ฎ๐ป
Is there a way to create a tRPC hook that doesn't fetch automatically on react c...
R
Rhys
โข
1/31/23, 1:52 PM
You can pass an additional parameter to use query which controls when that query will run
, in this case try passing
,
{
enabled
: textUserHasEnenter
.length
> 5
}
๏ฟฝ
๐๐ฎ๐ฝ๐ฎ๐ป
I've actually tried using enabled: false. However I still ran into the issue of ...
R
Rhys
โข
1/31/23, 1:58 PM
There
โs extra options like refetch on mount I think which you can set to false
, maybe give that a go
R
Rhys
โข
1/31/23, 1:59 PM
In my experience enabled
: false has resulted in it not fetching on mount though so that
โs strange
R
Rhys
โข
1/31/23, 1:59 PM
Try passing just enabled
: false
, not any actual conditionals with the string to see if it still fetches once on mount
R
Rhys
โข
1/31/23, 1:59 PM
That
โll help us narrow down what the problem is