diff --git a/app/client/cypress/e2e/Regression/ServerSide/JsFunctionExecution/PlatformFn_spec.ts b/app/client/cypress/e2e/Regression/ServerSide/JsFunctionExecution/PlatformFn_spec.ts index 6561ce1acf..d65e9a4787 100644 --- a/app/client/cypress/e2e/Regression/ServerSide/JsFunctionExecution/PlatformFn_spec.ts +++ b/app/client/cypress/e2e/Regression/ServerSide/JsFunctionExecution/PlatformFn_spec.ts @@ -5,6 +5,7 @@ import { jsEditor, debuggerHelper, tedTestConfig, + locators, } from "../../../../support/Objects/ObjectsCore"; describe("Tests functionality of platform function", () => { @@ -144,4 +145,28 @@ describe("Tests functionality of platform function", () => { debuggerHelper.DoesConsoleLogExist("Hello from setTimeout inside API"); }); }); + + it("2.Bug 16135 ShowAlert with same texts, when invoked from different triggers are combined", () => { + jsEditor.CreateJSObject( + `export default { + showTwoSameToastMessageAlerts: () => { + showAlert( "Hello World" ); + showAlert( "Hello World" ); + }, + + }`, + { + paste: true, + completeReplace: true, + toRun: false, + shouldCreateNewJSObj: true, + prettify: false, + }, + ); + agHelper.Sleep(); + jsEditor.RunJSObj(); + agHelper.AssertElementLength(locators._toastMsg, 2); + agHelper.ValidateToastMessage("Hello World", 0); + agHelper.ValidateToastMessage("Hello World", 1); + }); }); diff --git a/app/client/src/sagas/ActionExecution/ShowAlertActionSaga.ts b/app/client/src/sagas/ActionExecution/ShowAlertActionSaga.ts index 803774fe1c..97f2f4340a 100644 --- a/app/client/src/sagas/ActionExecution/ShowAlertActionSaga.ts +++ b/app/client/src/sagas/ActionExecution/ShowAlertActionSaga.ts @@ -5,6 +5,7 @@ import type { ToastKind } from "design-system"; import type { TShowAlertDescription } from "workers/Evaluation/fns/showAlert"; import { call } from "redux-saga/effects"; import showToast from "sagas/ToastSagas"; +import { uniqueId } from "lodash"; export default function* showAlertSaga(action: TShowAlertDescription) { const { payload } = action; @@ -22,6 +23,7 @@ export default function* showAlertSaga(action: TShowAlertDescription) { payload.message, { kind: payload.style as ToastKind, + toastId: uniqueId("ToastId"), }, { forceDisplay: true }, );