appsmithorg / appsmith

Platform to build admin panels, internal tools, and dashboards. Integrates with 25+ databases and any API.
https://www.appsmith.com
Apache License 2.0
34.64k stars 3.74k forks source link

[Bug]: Clone error when user calls a higher-order-function #22965

Open ohansFavour opened 1 year ago

ohansFavour commented 1 year ago

Is there an existing issue for this?

Description

Binding a function to a trigger field, without calling it, throws an error

Steps To Reproduce

  1. Create a JSObject
export default {
    myVar1: [],
    myVar2: {},
    myFun1 () {
        showAlert("myFun1 Called")
    },

    debounce : (fn,delay=300)=>{
  let timer;
  return function some(){
   if(timer){
    clearTimeout(timer)
   }
   timer = setTimeout(()=>{
    fn();
   },delay)
  }
 }, 
}
  1. DnD a button, in the onClick field, bind the following

{{JSObject2.debounce(JSObject2.myFun1(), 300)}}

  1. Click on Button, and see error toast

Public Sample App

No response

Environment

Production

Issue video log

No response

Version

Cloud

Front logo Front conversations

ohansFavour commented 1 year ago

In Appsmith v1.9.15, no error was getting thrown. Error toast appears from v1.9.16 upwards

rimildeyjsr commented 1 year ago

Connected to - https://github.com/appsmithorg/appsmith/issues/22332