Skip to content

Commit f5e8371

Browse files
G4brymDebian
andauthored
fix: prevent TypeError when route.name is undefined (G4brym#124)
Add optional chaining to this.$route.name access in BucketPicker, LeftSidebar, and RightSidebar components. Falls back to "files" when route name is undefined, preventing the TypeError reported in G4brym#64. Fixes G4brym#64 Co-authored-by: Debian <openclaw@openclaw.1.1.1.1>
1 parent 6166198 commit f5e8371

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

packages/dashboard/src/components/main/BucketPicker.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export default defineComponent({
3737
return this.$route.params.bucket;
3838
},
3939
selectedApp: function () {
40-
return this.$route.name.split("-")[0];
40+
return this.$route.name?.split("-")[0] || "files";
4141
},
4242
},
4343
setup() {

packages/dashboard/src/components/main/LeftSidebar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ export default defineComponent({
138138
return this.$route.params.bucket;
139139
},
140140
selectedApp: function () {
141-
return this.$route.name.split("-")[0];
141+
return this.$route.name?.split("-")[0] || "files";
142142
},
143143
},
144144
async mounted() {

packages/dashboard/src/components/main/RightSidebar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ export default defineComponent({
175175
return this.$route.params.bucket;
176176
},
177177
selectedApp: function () {
178-
return this.$route.name.split("-")[0];
178+
return this.$route.name?.split("-")[0] || "files";
179179
},
180180
},
181181
mounted() {

0 commit comments

Comments
 (0)