Skip to content

Commit

Permalink
Editing via esc does not correctly update node view (#3732)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelMauderer authored Sep 26, 2022
1 parent ccd5fa1 commit 98ace6a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/gui/src/controller/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -842,15 +842,15 @@ impl Handle {
/// Sets the given's node expression.
#[profile(Debug)]
pub fn set_expression(&self, id: ast::Id, expression_text: impl Str) -> FallibleResult {
info!(self.logger, "Setting node {id} expression to `{expression_text.as_ref()}`");
tracing::info!("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)
}

/// Sets the given's node expression.
#[profile(Debug)]
pub fn set_expression_ast(&self, id: ast::Id, expression: Ast) -> FallibleResult {
info!(self.logger, "Setting node {id} expression to `{expression.repr()}`");
tracing::info!("Setting node {id} expression to `{}`", expression.repr());
self.update_definition_ast(|definition| {
let mut graph = GraphInfo::from_definition(definition);
graph.edit_node(id, expression)?;
Expand Down
5 changes: 4 additions & 1 deletion app/gui/src/presenter/graph/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,10 @@ impl<'a> ViewChange<'a> {
expression
);
let expression_has_changed = displayed.expression != expression;
expression_has_changed.as_some(ast_id)
expression_has_changed.then(|| {
displayed.expression = expression;
ast_id
})
}
}

Expand Down

0 comments on commit 98ace6a

Please sign in to comment.