chore: Cache timezones by calcom version (#15556)

* chore: Cache timezones by calcom version

* Fix types
This commit is contained in:
Keith Williams authored and GitHub committed 2024-06-26 11:43:02 +00:00
1 parent 9613b9da6d
commit e33930e5c0
5 files changed
+24 -12

No files matched your search

@@ -3,6 +3,7 @@ import type { ITimezoneOption, ITimezone, Props as SelectProps } from "react-tim
import BaseSelect from "react-timezone-select";
import { classNames } from "@calcom/lib";
import { CALCOM_VERSION } from "@calcom/lib/constants";
import { filterByCities, addCitiesToDropdown, handleOptionLabel } from "@calcom/lib/timezone";
import { trpc } from "@calcom/trpc/react";
@@ -18,9 +19,14 @@ export type TimezoneSelectProps = SelectProps & {
timezoneSelectCustomClassname?: string;
};
export function TimezoneSelect(props: TimezoneSelectProps) {
const { data, isPending } = trpc.viewer.timezones.cityTimezones.useQuery(undefined, {
trpc: { context: { skipBatch: true } },
});
const { data, isPending } = trpc.viewer.timezones.cityTimezones.useQuery(
{
CalComVersion: CALCOM_VERSION,
},
{
trpc: { context: { skipBatch: true } },
}
);
return <TimezoneSelectComponent data={data} isPending={isPending} {...props} />;
}