Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
matthew-carroll opened this issue Sep 26, 2024 · 0 comments
Labels
area_super_reader Related to SuperReader area_supereditor Pertains to SuperEditor bounty_junior f:superlist Funded by Superlist time: 1 1hr or less

Comments

@matthew-carroll
Copy link
Contributor

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.

@matthew-carroll matthew-carroll added area_supereditor Pertains to SuperEditor bounty_junior f:superlist Funded by Superlist time: 1 1hr or less area_super_reader Related to SuperReader labels Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area_super_reader Related to SuperReader area_supereditor Pertains to SuperEditor bounty_junior f:superlist Funded by Superlist time: 1 1hr or less
Projects
None yet
Development

No branches or pull requests

1 participant