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
When ViewModels are serialized to the session and then deserialized, the data from ViewModel.extendedViewModel is lost.
Since ViewModel.extendedViewModel works fine in Handlebars, losing this information during session handling was unexpected to me.
We stumbled upon this problem when we wanted to add a boolean field to MiniCartBean. Not using the extended view model but introducing a subclass of MiniCartBean is undoable because
CartInSession having all private fields so a lot of information needs to be duplicated in the subclass
MiniCartBeanFactory.create(Cart) not delegating to a separately overridable method that creates a Bean instance and at the same time being invoked via super.create(...) from TruncatedMiniCartBeanFactory so our subclass of TruncatedMiniCartBeanFactory cannot override MiniCartBeanFactory.create(Cart) in an effective way. Of course we could start copying more of TruncatedMiniCartBeanFactory but code copying has limits, right?
We would like to show a message in the minicart explicating that it has been truncated. We're not able to do that right now due to above limitations.
ViewModels are serialized to the session and then deserialized, the data fromViewModel.extendedViewModelis lost.ViewModel.extendedViewModelworks fine in Handlebars, losing this information during session handling was unexpected to me.MiniCartBean. Not using the extended view model but introducing a subclass ofMiniCartBeanis undoable becauseMiniCartBeanFactory.create(Cart)not delegating to a separately overridable method that creates a Bean instance and at the same time being invoked viasuper.create(...)fromTruncatedMiniCartBeanFactoryso our subclass ofTruncatedMiniCartBeanFactorycannot overrideMiniCartBeanFactory.create(Cart)in an effective way. Of course we could start copying more ofTruncatedMiniCartBeanFactorybut code copying has limits, right?