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
{{ message }}
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.
I have found that as my Chaplin applications grow it makes sense to nest models, some working examples might be a Post with a child collection of images that are used in subviews.
However, upon saving/changing to a different instance of the parent model a quasi-Singleton/ghost model bug can emerge on the nested models, so that a complete new Post may be initialized but somehow the images are referencing another post's images.
Initially I solved this by manually disposing my nested models via a super in Model::dispose method of every model, but recently I patched my version of Chaplin.Model::dipose to contain the following:
attr.dispose?() for attr of @attributes
I am not sure if there is a reason that the Model::dispose method doesn't already contain this fallback for nested models, but I have not noticed any unintended results from it, and it has made my model declaration a bit more straightforward.
The text was updated successfully, but these errors were encountered:
I have found that as my Chaplin applications grow it makes sense to nest models, some working examples might be a Post with a child collection of images that are used in subviews.
However, upon saving/changing to a different instance of the parent model a quasi-Singleton/ghost model bug can emerge on the nested models, so that a complete new Post may be initialized but somehow the images are referencing another post's images.
Initially I solved this by manually disposing my nested models via a super in Model::dispose method of every model, but recently I patched my version of Chaplin.Model::dipose to contain the following:
I am not sure if there is a reason that the Model::dispose method doesn't already contain this fallback for nested models, but I have not noticed any unintended results from it, and it has made my model declaration a bit more straightforward.
The text was updated successfully, but these errors were encountered: