refactor: Only send dirty fields for event type update call (#13292)
* init * typefix maybe * fix type * fix e2e * Extract delete dialog to its own function to optimise rerender * wip * Delete isEqual * adds eslint tsignore comment * only update changed fields * fix type err * --WIP * fix type err isLoading—>isPending * isLoading—>isPending * post conflict resoution fix * shouldDirty minimumBookingNotice * adds shouldDirty to setValues * reset form to ensure updated default values * shouldDirty changes and fixed deep check of dirty * --WIP * should dirty recurring * shouldDirty team tab * multiple-fixes * adding console log to test something in e2e * shouldDirty apps tab * fixes managed event type children association * fixed managed events update * dirty managed fix * fixes some onChange versus setValue and periodCountCalendarDays * Seeing different behaviour explicitly unwrapping formState * only mutate if at least 1 field dirty * fix type error * bunch of fixes * --WIP * update only dirtyFields for Managed Events existing children * Fixes update old managed event type tests --WIP * Fix unit tests A bunch of unit test fixes which started failing due to update fields only requiring actual updated fields. some other small fixes also included * type fix * remove unnecessary comment * Adds dirtyField to instant event * fix: add shouldDirty * fixes availability and team tabs, and disable save button unless dirty * fix for hosts and bookerLayout * add shouldDirty when resetting hosts after changing schedulingType * add missing shouldDirty to useEventTypeDestinationCalendarEmail --------- Co-authored-by: Alex van Andel <[email protected]> Co-authored-by: Udit Takkar <[email protected]> Co-authored-by: CarinaWolli <[email protected]>
This commit is contained in:
15 files changed
+382
-196
No files matched your search
@@ -42,6 +42,7 @@ describe("handleChildrenEventTypes", () => {
|
||||
connectedLink: null,
|
||||
prisma: prismaMock,
|
||||
profileId: null,
|
||||
updatedValues: {},
|
||||
});
|
||||
expect(result.newUserIds).toEqual(undefined);
|
||||
expect(result.oldUserIds).toEqual(undefined);
|
||||
@@ -62,6 +63,7 @@ describe("handleChildrenEventTypes", () => {
|
||||
connectedLink: null,
|
||||
prisma: prismaMock,
|
||||
profileId: null,
|
||||
updatedValues: {},
|
||||
});
|
||||
expect(result.newUserIds).toEqual(undefined);
|
||||
expect(result.oldUserIds).toEqual(undefined);
|
||||
@@ -88,6 +90,7 @@ describe("handleChildrenEventTypes", () => {
|
||||
connectedLink: null,
|
||||
prisma: prismaMock,
|
||||
profileId: null,
|
||||
updatedValues: {},
|
||||
});
|
||||
expect(result.newUserIds).toEqual(undefined);
|
||||
expect(result.oldUserIds).toEqual(undefined);
|
||||
@@ -125,6 +128,7 @@ describe("handleChildrenEventTypes", () => {
|
||||
connectedLink: null,
|
||||
prisma: prismaMock,
|
||||
profileId: null,
|
||||
updatedValues: {},
|
||||
});
|
||||
expect(prismaMock.eventType.create).toHaveBeenCalledWith({
|
||||
data: {
|
||||
@@ -173,13 +177,14 @@ describe("handleChildrenEventTypes", () => {
|
||||
connectedLink: null,
|
||||
prisma: prismaMock,
|
||||
profileId: null,
|
||||
updatedValues: {
|
||||
bookingLimits: undefined,
|
||||
},
|
||||
});
|
||||
expect(prismaMock.eventType.update).toHaveBeenCalledWith({
|
||||
data: {
|
||||
...evType,
|
||||
hidden: false,
|
||||
bookingLimits: undefined,
|
||||
durationLimits: undefined,
|
||||
recurringEvent: undefined,
|
||||
hashedLink: { create: { link: expect.any(String) } },
|
||||
},
|
||||
where: {
|
||||
@@ -207,6 +212,7 @@ describe("handleChildrenEventTypes", () => {
|
||||
connectedLink: null,
|
||||
prisma: prismaMock,
|
||||
profileId: null,
|
||||
updatedValues: {},
|
||||
});
|
||||
expect(result.newUserIds).toEqual([]);
|
||||
expect(result.oldUserIds).toEqual([]);
|
||||
@@ -232,6 +238,7 @@ describe("handleChildrenEventTypes", () => {
|
||||
connectedLink: null,
|
||||
prisma: prismaMock,
|
||||
profileId: null,
|
||||
updatedValues: {},
|
||||
});
|
||||
// Have been called
|
||||
expect(result.newUserIds).toEqual([5]);
|
||||
@@ -270,6 +277,7 @@ describe("handleChildrenEventTypes", () => {
|
||||
connectedLink: null,
|
||||
prisma: prismaMock,
|
||||
profileId: null,
|
||||
updatedValues: {},
|
||||
});
|
||||
expect(prismaMock.eventType.create).toHaveBeenCalledWith({
|
||||
data: {
|
||||
@@ -318,14 +326,15 @@ describe("handleChildrenEventTypes", () => {
|
||||
connectedLink: null,
|
||||
prisma: prismaMock,
|
||||
profileId: null,
|
||||
updatedValues: {
|
||||
length: 30,
|
||||
},
|
||||
});
|
||||
expect(prismaMock.eventType.update).toHaveBeenCalledWith({
|
||||
data: {
|
||||
...evType,
|
||||
bookingLimits: undefined,
|
||||
durationLimits: undefined,
|
||||
recurringEvent: undefined,
|
||||
scheduleId: undefined,
|
||||
hidden: false,
|
||||
length: 30,
|
||||
hashedLink: undefined,
|
||||
},
|
||||
where: {
|
||||
userId_parentId: {
|
||||
@@ -379,6 +388,7 @@ describe("handleChildrenEventTypes", () => {
|
||||
connectedLink: null,
|
||||
prisma: prismaMock,
|
||||
profileId: null,
|
||||
updatedValues: {},
|
||||
});
|
||||
expect(prismaMock.eventType.create).toHaveBeenCalledWith({
|
||||
data: {
|
||||
@@ -404,13 +414,8 @@ describe("handleChildrenEventTypes", () => {
|
||||
});
|
||||
expect(prismaMock.eventType.update).toHaveBeenCalledWith({
|
||||
data: {
|
||||
...evType,
|
||||
bookingLimits: undefined,
|
||||
durationLimits: undefined,
|
||||
recurringEvent: undefined,
|
||||
hidden: false,
|
||||
hashedLink: undefined,
|
||||
workflows: undefined,
|
||||
scheduleId: undefined,
|
||||
},
|
||||
where: {
|
||||
userId_parentId: {
|
||||
|
||||
Reference in new issue
Block a user