Skip to content

[SuperEditor][SuperReader] - Move all components to accept view models instead of properties #2349

Open
@matthew-carroll

Description

@matthew-carroll

Creating a document component requires a process that begins with creating a view model from a document node, and then creating a widget from a view model.

Some of our document components directly accept an instance of their associated view model. Other components copy properties from their view model into the widget.

I think the reason that we initially copied individual properties is because view models are mutable. It would be a bug to alter a view model that's passed into a widget (because widgets are immutable).

However, our view model pipeline creates a final copy of a view model for each component builder. Therefore, in practice, the view model should never change out from under a component widget.

To reduce our work when creating components, and to maintain consistency in our approach, and to teach others a less verbose approach, change each document component widget to accept its corresponding view model instead of a bunch of properies.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions