bnugggets
bnugggets
TTCTheo's Typesafe Cult
Created by bnugggets on 5/15/2023 in #questions
Disabled tRPC Query, default inputs
I have to wait for some data to exist before running the query. Typescript complains that I need to pass a string so I have to put a useless default in my query input (selectedBatch?._id || ""). Is there a better/cleaner way to do this?
api.bri.useQuery(
selectedBatch?._id || "",
{
enabled: !!selectedBatch,
}
);
api.bri.useQuery(
selectedBatch?._id || "",
{
enabled: !!selectedBatch,
}
);
2 replies