From 146b8a56952a50e8a597ef2cf8ad996c6d51766d Mon Sep 17 00:00:00 2001 From: Ilya Bogdanov Date: Fri, 30 Sep 2022 17:42:05 +0300 Subject: [PATCH] Revert "Editing via `esc` does not correctly update node view (#3732)" (#3751) This reverts commit 98ace6a1d178b44e050997aff46b2f86a6a1c721. --- app/gui/src/controller/graph.rs | 4 ++-- app/gui/src/presenter/graph/state.rs | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/app/gui/src/controller/graph.rs b/app/gui/src/controller/graph.rs index 9d29c3ea5cb9..a97ec38f219e 100644 --- a/app/gui/src/controller/graph.rs +++ b/app/gui/src/controller/graph.rs @@ -842,7 +842,7 @@ impl Handle { /// Sets the given's node expression. #[profile(Debug)] pub fn set_expression(&self, id: ast::Id, expression_text: impl Str) -> FallibleResult { - tracing::info!("Setting node {id} expression to `{}`", expression_text.as_ref()); + info!(self.logger, "Setting node {id} expression to `{expression_text.as_ref()}`"); let new_expression_ast = self.parse_node_expression(expression_text)?; self.set_expression_ast(id, new_expression_ast) } @@ -850,7 +850,7 @@ impl Handle { /// Sets the given's node expression. #[profile(Debug)] pub fn set_expression_ast(&self, id: ast::Id, expression: Ast) -> FallibleResult { - tracing::info!("Setting node {id} expression to `{}`", expression.repr()); + info!(self.logger, "Setting node {id} expression to `{expression.repr()}`"); self.update_definition_ast(|definition| { let mut graph = GraphInfo::from_definition(definition); graph.edit_node(id, expression)?; diff --git a/app/gui/src/presenter/graph/state.rs b/app/gui/src/presenter/graph/state.rs index 4e5cd654d818..12e5df48ff2f 100644 --- a/app/gui/src/presenter/graph/state.rs +++ b/app/gui/src/presenter/graph/state.rs @@ -670,10 +670,7 @@ impl<'a> ViewChange<'a> { expression ); let expression_has_changed = displayed.expression != expression; - expression_has_changed.then(|| { - displayed.expression = expression; - ast_id - }) + expression_has_changed.as_some(ast_id) } }