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.11k stars 3.69k forks source link

[Bug]-[Infinity]:JSObject `this.` doesn’t work similar to javascript for few cases #15472

Open rishabhrathod01 opened 2 years ago

rishabhrathod01 commented 2 years ago

Is there an existing issue for this?

Description

Current JSObject logic to replace this. with JSObjectName. causes JSObject to not handle as expected according to javascript spec.

Intercom user query link

User shared screenshot object functions this scope

Steps To Reproduce

  1. Create a JSObject
    export default {
    myFunc: () => {
     const obj = {
           test: [1,2,3],
           getList(){ return this.test; }
     }
     return obj.getList()
    }
    }
  2. call myFunc and check output

Workaround

Instead of using this.test use obj.test to point the particular object.

export default {
myFunc: () => {
     const obj = {
           test: [1,2,3],
           getList(){ return obj.test; }
     }
     return obj.getList()
}
}

Version

1.7.9

bharath31 commented 2 years ago

Assuming 5% of JSObject users face this issue

Stats

Stat Values
Reach 150
Effort (months) <>
bharath31 commented 1 year ago

@Rishabh-Rathod @arunvjn could you add an estimate for fixing this issue?