Index: src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java
===================================================================
--- src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java	(revision 19004)
+++ src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java	(working copy)
@@ -405,6 +405,7 @@
     /**
      * builds the panel with the OK and the Cancel button
      * @param okAction OK action
+     * @param deleteAction  Delete action
      * @param cancelAction Cancel action
      *
      * @return the panel with the OK and the Cancel button
@@ -421,7 +422,7 @@
         pnl.add(new JButton(new ContextSensitiveHelpAction(ht("/Dialog/RelationEditor"))));
         // Keep users from saving invalid relations -- a relation MUST have at least a tag with the key "type"
         // AND must contain at least one other OSM object.
-        final TableModelListener listener = l -> updateOkPanel(this.actionAccess.getChangedRelation(), okButton, deleteButton);
+        final TableModelListener listener = l -> updateOkPanel(okButton, deleteButton);
         listener.tableChanged(null);
         this.memberTableModel.addTableModelListener(listener);
         this.tagEditorPanel.getModel().addTableModelListener(listener);
@@ -429,12 +430,13 @@
     }
 
     /**
-     * Update the OK panel area
-     * @param newRelation What the new relation would "look" like if it were to be saved now
+     * Update the OK panel area with a temporary relation that looks if it were to be saved now.
      * @param okButton The OK button
      * @param deleteButton The delete button
      */
-    private void updateOkPanel(IRelation<?> newRelation, JButton okButton, JButton deleteButton) {
+    private void updateOkPanel(JButton okButton, JButton deleteButton) {
+        Relation oldRelation = this.actionAccess.getEditor().getRelation();
+        IRelation<?> newRelation = this.actionAccess.getChangedRelation();
         okButton.setVisible(newRelation.isUseful() || this.getRelationSnapshot() == null);
         deleteButton.setVisible(!newRelation.isUseful() && this.getRelationSnapshot() != null);
         if (this.getRelationSnapshot() == null && !newRelation.isUseful()) {
@@ -442,6 +444,8 @@
         } else {
             okButton.setText(tr("OK"));
         }
+        if (newRelation != oldRelation && newRelation.getMembersCount() > 0)
+            newRelation.setMembers(null); // see #19885, #23527
     }
 
     /**
Index: src/org/openstreetmap/josm/gui/dialogs/relation/actions/ApplyAction.java
===================================================================
--- src/org/openstreetmap/josm/gui/dialogs/relation/actions/ApplyAction.java	(revision 19004)
+++ src/org/openstreetmap/josm/gui/dialogs/relation/actions/ApplyAction.java	(working copy)
@@ -5,6 +5,8 @@
 
 import java.awt.event.ActionEvent;
 
+import org.openstreetmap.josm.data.osm.IRelation;
+import org.openstreetmap.josm.data.osm.Relation;
 import org.openstreetmap.josm.tools.ImageProvider;
 
 /**
@@ -35,6 +37,14 @@
 
     @Override
     public void updateEnabledState() {
-        setEnabled(this.editorAccess.getChangedRelation().isUseful() && isEditorDirty());
+        boolean enable = isEditorDirty();
+        if (enable) {
+            Relation oldRelation = this.getEditor().getRelation();
+            IRelation<?> newRelation = this.editorAccess.getChangedRelation();
+            enable = newRelation.isUseful();
+            if (oldRelation != newRelation && newRelation.getMembersCount() > 0)
+                newRelation.setMembers(null); // see #19885, #23527
+        }
+        setEnabled(enable);
     }
 }
Index: src/org/openstreetmap/josm/gui/dialogs/relation/actions/CancelAction.java
===================================================================
--- src/org/openstreetmap/josm/gui/dialogs/relation/actions/CancelAction.java	(revision 19004)
+++ src/org/openstreetmap/josm/gui/dialogs/relation/actions/CancelAction.java	(working copy)
@@ -48,7 +48,11 @@
         if ((!getMemberTableModel().hasSameMembersAs(snapshot) || getTagModel().isDirty())
          && !(snapshot == null && getTagModel().getTags().isEmpty())) {
             //give the user a chance to save the changes
-            int ret = confirmClosingByCancel(this.editorAccess.getChangedRelation());
+            Relation oldRel = this.editorAccess.getEditor().getRelation();
+            IRelation<?> newRelation = this.editorAccess.getChangedRelation();
+            int ret = confirmClosingByCancel(newRelation);
+            if (oldRel != newRelation && newRelation.getMembersCount() > 0)
+                newRelation.setMembers(null); // see #19885, #23527
             if (ret == 0) { //Yes, save the changes
                 //copied from OKAction.run()
                 Config.getPref().put("relation.editor.generic.lastrole", Utils.strip(tfRole.getText()));
