Closed distantnative closed 3 months ago
items
In Vue 3 the page/file parameter inside the map closure will be reactive. So assigning new values will directly mutate the original object. Which is problematic in this case https://github.com/getkirby/kirby/compare/v5/develop...v5/refactor/nonmutating-modelssection-items-computed?expand=1#diff-97e5d0547fc36db8267a17f7b8e71ce28763c11dcba313d445cef261fce2ebc0R25 where we add the status button to other buttons. When the object is reactive, this adds an additional status button to the list, each time the computed prop code runs. By refactoring the code this is avoided.
Description
Summary of changes
items
computed maps the items by returning new objects instead of mutating the model parameter directlyReasoning
In Vue 3 the page/file parameter inside the map closure will be reactive. So assigning new values will directly mutate the original object. Which is problematic in this case https://github.com/getkirby/kirby/compare/v5/develop...v5/refactor/nonmutating-modelssection-items-computed?expand=1#diff-97e5d0547fc36db8267a17f7b8e71ce28763c11dcba313d445cef261fce2ebc0R25 where we add the status button to other buttons. When the object is reactive, this adds an additional status button to the list, each time the computed prop code runs. By refactoring the code this is avoided.
Ready?