Explorar o código

Scroll to top of page on "new exercise".

Lee Morgan hai 1 ano
pai
achega
5a38196695
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  1. 3 1
      views/js/pages/session.js

+ 3 - 1
views/js/pages/session.js

@@ -187,6 +187,8 @@ export default {
         switch(exercise.type){
             case "weights": this.displayWeightSets(exercise.sets, setsContainer);
         }
+
+        window.scrollTo(0, 0);
     },
 
     displayWeightSets: function(sets, container){
@@ -239,7 +241,7 @@ export default {
 
         for(let i = 0; i < this.pastSessions.length; i++){
             for(let j = 0; j < this.pastSessions[i].exercises.length; j++){
-                if(this.pastSessions[i].exercises[j].exerciseId === id){
+                if(this.pastSessions[i].exercises[j]?.exerciseId === id){
                     note.textContent = "*Data autofilled from previous workout";
                     return this.pastSessions[i].exercises[j].sets;
                 }