From 4506766a05e420142a8a163a4fdead98cf9d293d Mon Sep 17 00:00:00 2001 From: Aswath K Date: Fri, 5 Nov 2021 15:08:46 +0530 Subject: [PATCH] fix: paste before copy resulted in value being undefined (#8954) * fix: paste before copy resulted in value being undefined * returns empty array on getCopiedWidget --- app/client/src/sagas/WidgetOperationSagas.tsx | 1 + app/client/src/utils/storage.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/app/client/src/sagas/WidgetOperationSagas.tsx b/app/client/src/sagas/WidgetOperationSagas.tsx index e7f25ee31a..90ef0a20bc 100644 --- a/app/client/src/sagas/WidgetOperationSagas.tsx +++ b/app/client/src/sagas/WidgetOperationSagas.tsx @@ -707,6 +707,7 @@ export function calculateNewWidgetPosition( */ function* pasteWidgetSaga(action: ReduxAction<{ groupWidgets: boolean }>) { let copiedWidgetGroups: CopiedWidgetGroup[] = yield getCopiedWidgets(); + if (!copiedWidgetGroups.length) return; const shouldGroup: boolean = action.payload.groupWidgets; const newlyCreatedWidgetIds: string[] = []; diff --git a/app/client/src/utils/storage.ts b/app/client/src/utils/storage.ts index e578ea8946..91fb95a81b 100644 --- a/app/client/src/utils/storage.ts +++ b/app/client/src/utils/storage.ts @@ -66,6 +66,7 @@ export const getCopiedWidgets = async () => { log.error("An error occurred when fetching copied widget: ", error); return; } + return []; }; export const setOnboardingState = async (onboardingState: boolean) => {