Skip to content

Commit

Permalink
Avoid needless save when adding a child to a parent that is already p…
Browse files Browse the repository at this point in the history
…art of its dataset
  • Loading branch information
nirvn committed Oct 12, 2024
1 parent 09c8f1a commit c04c3a0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ EditorWidgetBase {
repeat: false

onTriggered: {
let saved = save();
let saved = form.state === 'Add' ? save() : true;
if (ProjectUtils.transactionMode(qgisProject) !== Qgis.TransactionMode.Disabled) {
// When a transaction mode is enabled, we must fallback to saving the parent feature to have provider-side issues
if (!saved) {
Expand Down Expand Up @@ -375,6 +375,14 @@ EditorWidgetBase {
}
}

BusyIndicator {
id: busyIndicator
anchors.centerIn: parent
width: 36
height: 36
running: orderedRelationModel.isLoading
}

Dialog {
id: deleteDialog
parent: mainWindow.contentItem
Expand Down Expand Up @@ -414,14 +422,6 @@ EditorWidgetBase {
}
}

BusyIndicator {
id: busyIndicator
anchors.centerIn: parent
width: 36
height: 36
running: orderedRelationModel.isLoading
}

EmbeddedFeatureForm {
id: embeddedPopup

Expand Down
18 changes: 9 additions & 9 deletions src/qml/editorwidgets/relationeditors/relation_editor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ EditorWidgetBase {
repeat: false

onTriggered: {
let saved = save();
let saved = form.state === 'Add' ? save() : true;
if (ProjectUtils.transactionMode(qgisProject) !== Qgis.TransactionMode.Disabled) {
// When a transaction mode is enabled, we must fallback to saving the parent feature to have provider-side issues
if (!saved) {
Expand Down Expand Up @@ -175,6 +175,14 @@ EditorWidgetBase {
}
}
}

BusyIndicator {
id: busyIndicator
anchors.centerIn: parent
width: 36
height: 36
running: relationEditorModel.isLoading
}
}

Component {
Expand Down Expand Up @@ -320,14 +328,6 @@ EditorWidgetBase {
}
}

BusyIndicator {
id: busyIndicator
anchors.centerIn: parent
width: 36
height: 36
running: relationEditorModel.isLoading
}

EmbeddedFeatureForm {
id: embeddedPopup

Expand Down

1 comment on commit c04c3a0

@qfield-fairy
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.