Skip to content

Commit c70e629

Browse files
committed
fix: correctly handle null styles
1 parent be53003 commit c70e629

6 files changed

Lines changed: 8 additions & 8 deletions

File tree

components/gymRoutes/GymRouteTable.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -764,8 +764,8 @@ export default {
764764
formatRoutes () {
765765
for (const route of this.routes) {
766766
const styles = []
767-
for (const section of route.sections) {
768-
for (const style of section.styles) {
767+
for (const section of route.sections ?? []) {
768+
for (const style of section.styles ?? []) {
769769
styles.push(style)
770770
}
771771
}

components/gymRoutes/forms/GymRouteForm.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ export default {
572572
gym_space_id: this.gymSector.gym_space.id,
573573
gym_sector_id: null,
574574
gym_id: this.gymSector.gym.id,
575-
sections: this.gymRoute?.sections || [{ grade: null, height: null, styles: [] }]
575+
sections: this.gymRoute?.sections ?? [{ grade: null, height: null, styles: [] }]
576576
},
577577
climbingGymList: [
578578
{ text: this.$t('models.climbs.sport_climbing'), value: 'sport_climbing' },

components/gymRoutes/partial/GymRouteClimbingSimpleStyleIcons.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ export default {
2828
methods: {
2929
icons () {
3030
const styles = []
31-
for (const section of this.gymRoute.sections) {
32-
for (const style of section.styles) {
31+
for (const section of this.gymRoute.sections ?? []) {
32+
for (const style of section.styles ?? []) {
3333
styles.push(style)
3434
}
3535
}

components/gymRoutes/partial/GymRouteClimbingStyleIcons.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div class="d-inline-bloc">
33
<template v-for="section in gymRoute.sections">
44
<v-icon
5-
v-for="(style, styleIndex) in section.styles"
5+
v-for="(style, styleIndex) in section.styles ?? []"
66
:key="`style-${styleIndex}`"
77
class="mr-1"
88
:color="styleColor(style)"

components/gymRoutes/partial/GymRouteClimbingStyles.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
L.{{ sectionIndex + 1 }} :
99
</span>
1010
<v-chip
11-
v-for="(style, styleIndex) in section.styles"
11+
v-for="(style, styleIndex) in section.styles ?? []"
1212
:key="`style-${styleIndex}`"
1313
small
1414
class="mr-2"

models/GymRoute.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export default class GymRoute extends ActiveData {
3131

3232
get hasStyles () {
3333
let styleCounter = 0
34-
for (const section of this.sections) {
34+
for (const section of this.sections ?? []) {
3535
styleCounter += section?.styles?.length || 0
3636
}
3737
return styleCounter > 0

0 commit comments

Comments
 (0)