Fix ui reconcilliation for empty children
This commit is contained in:
parent
5141643531
commit
6089c02e90
1 changed files with 8 additions and 2 deletions
|
|
@ -87,7 +87,10 @@ namespace psemek::ui::impl
|
||||||
{
|
{
|
||||||
impl->set_child_token(typed_value.child.subscribe([this, impl = impl.get(), &state, &delayed_executor, request_reshape, holder = typed_value.child](std::any const & child){
|
impl->set_child_token(typed_value.child.subscribe([this, impl = impl.get(), &state, &delayed_executor, request_reshape, holder = typed_value.child](std::any const & child){
|
||||||
delayed_executor.post([this, impl, &state, &delayed_executor, request_reshape, child]{
|
delayed_executor.post([this, impl, &state, &delayed_executor, request_reshape, child]{
|
||||||
impl->set_child(reconciliate(impl->release_child(), child, state, delayed_executor, request_reshape));
|
if (child.has_value())
|
||||||
|
impl->set_child(reconciliate(impl->release_child(), child, state, delayed_executor, request_reshape));
|
||||||
|
else
|
||||||
|
impl->release_child();
|
||||||
request_reshape();
|
request_reshape();
|
||||||
});
|
});
|
||||||
}, true));
|
}, true));
|
||||||
|
|
@ -145,7 +148,10 @@ namespace psemek::ui::impl
|
||||||
child_tokens[i] = children_values[i].element.subscribe([this, impl, &state, &delayed_executor, request_reshape, i, holder = children_values[i].element](std::any const & value){
|
child_tokens[i] = children_values[i].element.subscribe([this, impl, &state, &delayed_executor, request_reshape, i, holder = children_values[i].element](std::any const & value){
|
||||||
delayed_executor.post([this, impl, &state, &delayed_executor, request_reshape, i, value]{
|
delayed_executor.post([this, impl, &state, &delayed_executor, request_reshape, i, value]{
|
||||||
auto children = impl->release_children();
|
auto children = impl->release_children();
|
||||||
children[i] = reconciliate(std::move(children[i]), value, state, delayed_executor, request_reshape);
|
if (value.has_value())
|
||||||
|
children[i] = reconciliate(std::move(children[i]), value, state, delayed_executor, request_reshape);
|
||||||
|
else
|
||||||
|
children[i] = nullptr;
|
||||||
impl->set_children(std::move(children));
|
impl->set_children(std::move(children));
|
||||||
request_reshape();
|
request_reshape();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue