Skip to content

Commit

Permalink
Make a clean copy of the 'code' when updating state
Browse files Browse the repository at this point in the history
  • Loading branch information
bgribble committed Feb 27, 2025
1 parent ad7d9b3 commit e0eba2b
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion mfp/builtins/pyfunc.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,6 @@ def __init__(self, init_type, init_args, patch, scope, name, defs=None):
self.thunk = patch.parse_obj(thunktxt)

arguments = get_arglist(self.thunk)

if arguments is not None:
self.argcount = len(arguments)
self.doc_tooltip_inlet = []
Expand Down
2 changes: 1 addition & 1 deletion mfp/gui/base_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ async def move(self, x, y, **kwargs):

@saga('code')
async def code_changed(self, action, state_diff, previous):
self.send_params()
yield self.send_params()

@mutates('obj_state')
async def delete(self, delete_obj=True):
Expand Down
2 changes: 1 addition & 1 deletion mfp/gui/imgui/app_window/info_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def render_code_editors(app_window):
if imgui.begin_menu("File"):
selected, _ = imgui.menu_item("Save", "", False)
if selected:
new_val = target.code or {}
new_val = {**target.code} if target.code else {}
new_val["body"] = editor.get_text()
new_val["lang"] = "python"
new_val["errorinfo"] = None
Expand Down
4 changes: 2 additions & 2 deletions mfp/gui/processor_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ async def recreate_element(self, action, state_diff, previous):
# don't recreate if this is the initial creation
if "code" not in state_diff:
if "obj_state" in state_diff and state_diff['obj_state'][0] == None:
return
yield None
if "obj_id" in state_diff and state_diff['obj_id'][0] == None:
return
yield None

if self.obj_type:
args = f" {self.obj_args}" if self.obj_args is not None else ''
Expand Down

0 comments on commit e0eba2b

Please sign in to comment.