Fix problems edit
[vchess.git] / client / src / views / Problems.vue
index 1c99064..1e8ff68 100644 (file)
@@ -313,15 +313,17 @@ export default {
             newProblem.id = ret.id;
             newProblem.uid = this.st.user.id;
             newProblem.uname = this.st.user.name;
-            this.problems = this.problems.concat(newProblem);
+            this.problems = [newProblem].concat(this.problems);
             this.resetCurProb();
           }
           this.infoMsg = "";
+          document.getElementById("modalNewprob").checked = false;
         }
       );
     },
     editProblem: function(prob) {
-      if (!prob.diag) this.setDiagram(prob); //V is loaded at this stage
+      // prob.diag might correspond to some other problem or be empty:
+      this.setDiagram(prob); //V is loaded at this stage
       this.copyProblem(prob, this.curproblem);
       window.doClick("modalNewprob");
     },