refactor: enable infinite scrolling for all (#16463)

* refactor: enable infinite scrolling for all

* chore: remove unused code

* fix: tests

* chore: type err

* chore: update email embed test

* chore: update tests

* chore: update tests

* chore: fix horizontal tabitem

* chore

* fix: conflicts

* chore: conflict

* fix: E2E tests

* chore: remove idle

* fix test

---------

Co-authored-by: Syed Ali Shahbaz <[email protected]>
This commit is contained in:
Udit TakkarandSyed Ali Shahbaz authored and GitHub committed 2024-09-30 10:44:04 +01:00
1 parent c834b927b6
commit ac300ff670
14 files changed
+67 -884

No files matched your search

@@ -64,7 +64,6 @@ const querySchema = z.object({
export default function CreateEventTypeDialog({
profileOptions,
isInfiniteScrollEnabled,
}: {
profileOptions: {
teamId: number | null | undefined;
@@ -72,7 +71,6 @@ export default function CreateEventTypeDialog({
image: string | undefined;
membershipRole: MembershipRole | null | undefined;
}[];
isInfiniteScrollEnabled: boolean;
}) {
const { t } = useLocale();
const router = useRouter();
@@ -115,11 +113,7 @@ export default function CreateEventTypeDialog({
);
};
const { form, createMutation, isManagedEventType } = useCreateEventType(
onSuccessMutation,
onErrorMutation,
isInfiniteScrollEnabled
);
const { form, createMutation, isManagedEventType } = useCreateEventType(onSuccessMutation, onErrorMutation);
const { register } = form;
const urlPrefix = orgBranding?.fullDomain ?? process.env.NEXT_PUBLIC_WEBSITE_URL;
@@ -149,7 +143,6 @@ export default function CreateEventTypeDialog({
SubmitButton={SubmitButton}
onSuccessMutation={onSuccessMutation}
onErrorMutation={onErrorMutation}
isInfiniteScrollEnabled={isInfiniteScrollEnabled}
/>
) : (
<Form
@@ -36,7 +36,7 @@ const querySchema = z.object({
parentId: z.coerce.number().optional().nullable(),
});
const DuplicateDialog = ({ isInfiniteScrollEnabled }: { isInfiniteScrollEnabled?: boolean }) => {
const DuplicateDialog = () => {
const utils = trpc.useUtils();
const searchParams = useCompatSearchParams();
@@ -74,15 +74,11 @@ const DuplicateDialog = ({ isInfiniteScrollEnabled }: { isInfiniteScrollEnabled?
onSuccess: async ({ eventType }) => {
await router.replace(`/event-types/${eventType.id}`);
if (isInfiniteScrollEnabled) {
await utils.viewer.eventTypes.getUserEventGroups.invalidate();
await utils.viewer.eventTypes.getEventTypesFromGroup.invalidate({
limit: 10,
group: { teamId: eventType?.teamId, parentId: eventType?.parentId },
});
} else {
await utils.viewer.eventTypes.getByViewer.invalidate();
}
await utils.viewer.eventTypes.getUserEventGroups.invalidate();
await utils.viewer.eventTypes.getEventTypesFromGroup.invalidate({
limit: 10,
group: { teamId: eventType?.teamId, parentId: eventType?.parentId },
});
showToast(
t("event_type_created_successfully", {