Skip to content
This repository was archived by the owner on Jun 20, 2025. It is now read-only.

Use of ViewModels in session is not transparent #682

@selo-ecube

Description

@selo-ecube
  • 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
    • Inconsistent use of (Truncated)MiniCartBeanFactory #681
    • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions