Rule edit: Only save rule if it has changed when opening script editor (#2203)

Fixes #2027.

When a script inside a rule was opened, the UI always saved the rule
before navigating to the script editor. With this fix, the rule is only
saved if there is a change to save. If the rule hasn't been changed, no
save request is performed.

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
pull/2208/head
Florian Hotze 2023-12-07 22:38:45 +01:00 committed by GitHub
parent 93a3e184a3
commit 0c199ec102
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -555,7 +555,7 @@ export default {
this.currentModuleType = mod.type
this.scriptCode = mod.configuration.script
const updatePromise = (this.rule.editable || this.isNewRule) ? this.save() : Promise.resolve()
const updatePromise = (this.rule.editable || this.isNewRule) && this.dirty ? this.save() : Promise.resolve()
updatePromise.then(() => {
this.$f7router.navigate('/settings/rules/' + this.rule.uid + '/script/' + mod.id, { transition: this.$theme.aurora ? 'f7-cover-v' : '' })
})