fix: prevent refetching country (#7622)

Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
This commit is contained in:
Udit Takkar
2023-03-09 10:38:57 +00:00
committed by GitHub
parent 65687d6110
commit d80581ad58
+4 -1
View File
@@ -36,7 +36,10 @@ function PhoneInput({ name, className = "", onChange, ...rest }: PhoneInputProps
const useDefaultCountry = () => {
const [defaultCountry, setDefaultCountry] = useState<Country>("US");
const query = trpc.viewer.public.countryCode.useQuery(undefined, {
trpc.viewer.public.countryCode.useQuery(undefined, {
refetchOnWindowFocus: false,
refetchOnReconnect: false,
retry: false,
onSuccess: (data) => {
if (isSupportedCountry(data?.countryCode)) {
setDefaultCountry(data.countryCode as Country);