refactor(workspace): Optimize save call on workspace doc (#24052)

Optimize Workspace.save_page to call doc.save() only once therefore
eliminate sending unnecessary queries to database.

Signed-off-by: Xiaoguang Sun <sunxiaoguang@gmail.com>
This commit is contained in:
Xiaoguang Sun 2024-01-01 14:08:40 +08:00 committed by GitHub
parent 64c221343e
commit 1fe3b5d5bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 2 deletions

View file

@ -565,7 +565,7 @@ def save_new_widget(doc, page, blocks, new_widgets):
page, json_config, e
)
doc.log_error("Could not save customization", log)
return False
raise
return True

View file

@ -277,7 +277,6 @@ def save_page(title, public, new_widgets, blocks):
doc = frappe.get_doc("Workspace", pages[0])
doc.content = blocks
doc.save(ignore_permissions=True)
save_new_widget(doc, title, blocks, new_widgets)