ryansolid / dom-expressions

A Fine-Grained Runtime for Performant DOM Rendering
MIT License
865 stars 124 forks source link

"this" references are no longer transformed correctly in some cases #111

Closed nicketson closed 2 years ago

nicketson commented 2 years ago

The issue can be seen here

The expression this.shouldStay here https://github.com/ryansolid/dom-expressions/blob/12fb07c130cf1a5c458bcd11260f9a8ed012f2a9/packages/babel-plugin-jsx-dom-expressions/test/__dom_fixtures__/components/code.js#L120

should be transformed into _self$.shouldStay here https://github.com/ryansolid/dom-expressions/blob/12fb07c130cf1a5c458bcd11260f9a8ed012f2a9/packages/babel-plugin-jsx-dom-expressions/test/__dom_fixtures__/components/output.js#L360

this is going to refer to the object literal being passed as the second argument to _$createComponent() instead of the this in the render function, which is what would be expected.

The bug was introduced in commit https://github.com/ryansolid/dom-expressions/commit/f8ea5cce69b18249f1f545a5827b50b98cac6440

ryansolid commented 2 years ago

Interesting because it looks like that commit was very intentional to fix a different issue. Trying to track down that issue now, but it is proving elusive.

titoBouzout commented 2 years ago

Isn't the issue that the getters are using the current scope instead of the parent? related https://github.com/ryansolid/mobx-jsx/issues/44 curious enough, at the time I sent that issue, it only happens when you double nest a custom component, it doesn't happen if you double nest a regular div.