Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix transformed properties assigned to incorrect entities. #1064

Merged
merged 6 commits into from May 2, 2024

Conversation

stephenh
Copy link
Collaborator

@stephenh stephenh commented Apr 30, 2024

When we lazy-initialized properties, i.e. like:

     "class Author {
         get numberOfBooks() { return this.__data.relations.numberOfBooks ??= hasAsyncProperty(() => {
             return 1;
         }); }
     }

I'd forgotten that internally hasAsyncProperty & friends using the currentlyInstantiatingEntity to know what to hook themselves up to (because this makes for a new API than always passing this as the 1st arg of every proepty).

So, properties got hooked up to "whatever random entity was last instantiated".

So we now fix-up the currentlyInstantiatingEntity in the getters:

     "class Author {
         get numberOfBooks() { return (setCurrentlyInstantiatingEntity(this), this.__data.relations.numberOfBooks ??= hasAsyncProperty(() => {
             return 1;
         })); }
     }

@stephenh stephenh force-pushed the fix-transformer-entity branch 3 times, most recently from 3262da7 to df10de3 Compare May 1, 2024 06:30
@stephenh stephenh merged commit 15126e9 into main May 2, 2024
4 checks passed
@stephenh stephenh deleted the fix-transformer-entity branch May 2, 2024 01:22
stephenh pushed a commit that referenced this pull request May 2, 2024
## [1.163.1](v1.163.0...v1.163.1) (2024-05-02)

### Bug Fixes

* Fix transformed properties assigned to incorrect entities. ([#1064](#1064)) ([15126e9](15126e9))
@stephenh
Copy link
Collaborator Author

stephenh commented May 2, 2024

🎉 This PR is included in version 1.163.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant