You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It appears to be assuming that the setOwner and setFactoryFor will continue to work for props after it is rebound on line 512—but they do not, because it is a completely new object. If I'm reading this method correctly, the original, empty POJO will simply be GC'd, since it's unused after the end of the method.
This has been this way for quite some time, but the cleanups for Ember v4 made it much more apparent.
I believe the correct update here is to change the entire chunk to simply be:
Previously, we stomped the `props` binding with an `Object.assign()`,
which meant that the original empty props object would get GC'd after
the end of the method and the item passed into the class created at the
end of the `FactoryManager.create` call would be a *different* object,
which does *not* have the factory or owner associations.
Fixes#20023
Previously, we stomped the `props` binding with an `Object.assign()`,
which meant that the original empty props object would get GC'd after
the end of the method and the item passed into the class created at the
end of the `FactoryManager.create` call would be a *different* object,
which does *not* have the factory or owner associations.
Fixes#20023
Previously, we stomped the `props` binding with an `Object.assign()`,
which meant that the original empty props object would get GC'd after
the end of the method and the item passed into the class created at the
end of the `FactoryManager.create` call would be a *different* object,
which does *not* have the factory or owner associations.
Fixes#20023
(cherry picked from commit d79edb3)
This code is either wrong or quite confusing:
ember.js/packages/@ember/-internals/container/lib/container.ts
Lines 507 to 513 in d8f8266
It appears to be assuming that the
setOwner
andsetFactoryFor
will continue to work forprops
after it is rebound on line 512—but they do not, because it is a completely new object. If I'm reading this method correctly, the original, empty POJO will simply be GC'd, since it's unused after the end of the method.This has been this way for quite some time, but the cleanups for Ember v4 made it much more apparent.
I believe the correct update here is to change the entire chunk to simply be:
That would maintain the object identity and therefore make owner and factory lookups for this
props
object continue to work correctly.The text was updated successfully, but these errors were encountered: