Revert "Reduce the amount of re-creation of cells in repeaters when the model changes (#1954)"

This reverts commit 1162ebbb79.

Because otherwise if we keep the elements, their internal state is kept
and this causes bug #2598

Fixes #2598
This commit is contained in:
Olivier Goffart 2023-10-23 09:12:04 +02:00 committed by Olivier Goffart
parent 0d366e0087
commit 78d273e599
4 changed files with 7 additions and 126 deletions

View file

@ -1133,14 +1133,7 @@ public:
void ensure_updated(const Parent *parent) const
{
if (model.is_dirty()) {
auto preserved_data = inner ? std::make_optional(std::move(inner->data)) : std::nullopt;
inner = std::make_shared<RepeaterInner>();
if (auto data = preserved_data) {
inner->data = std::move(*data);
for (auto &&compo_with_state : inner->data) {
compo_with_state.state = RepeaterInner::State::Dirty;
}
}
if (auto m = model.get()) {
m->attach_peer(inner);
}