Build UserInterface only once on Outcome::Chain

This commit is contained in:
Héctor Ramón Jiménez 2022-08-02 17:34:04 +02:00
parent 77c6864e7c
commit 54ad92ce91
No known key found for this signature in database
GPG key ID: 140CC052C94F138E

View file

@ -662,17 +662,16 @@ pub fn run_command<A, E>(
let mut current_cache = std::mem::take(cache); let mut current_cache = std::mem::take(cache);
let mut current_operation = Some(action.into_operation()); let mut current_operation = Some(action.into_operation());
while let Some(mut operation) = current_operation.take() { let mut user_interface = build_user_interface(
let mut user_interface = build_user_interface( application,
application, current_cache,
current_cache, renderer,
renderer, state.logical_size(),
state.logical_size(), debug,
debug, );
);
while let Some(mut operation) = current_operation.take() {
user_interface.operate(renderer, operation.as_mut()); user_interface.operate(renderer, operation.as_mut());
current_cache = user_interface.into_cache();
match operation.finish() { match operation.finish() {
operation::Outcome::None => {} operation::Outcome::None => {}
@ -687,6 +686,7 @@ pub fn run_command<A, E>(
} }
} }
current_cache = user_interface.into_cache();
*cache = current_cache; *cache = current_cache;
} }
} }