Skip to content

Commit d1d4fbf

Browse files
authored
Merge pull request #7660 from nextcloud/fixBoardIdNull
fix(session): Add null check for boardId in createSession
2 parents 4ccb538 + f781993 commit d1d4fbf

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/components/board/Board.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,14 +163,14 @@ export default {
163163
},
164164
},
165165
created() {
166-
this.session = createSession(this.id)
166+
// Session is created in fetchData() after loadBoardById succeeds
167167
this.fetchData()
168168
this.$root.$on('open-card', (cardId) => {
169169
this.localModal = cardId
170170
})
171171
},
172172
beforeDestroy() {
173-
this.session.close()
173+
this.session?.close()
174174
},
175175
methods: {
176176
async fetchData() {

src/sessions.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export function isNotifyPushEnabled() {
7373
*/
7474
export function createSession(boardId) {
7575

76-
if (!isNotifyPushEnabled()) {
76+
if (!boardId || !isNotifyPushEnabled()) {
7777
// return a dummy object
7878
return {
7979
async close() {},
@@ -107,7 +107,7 @@ export function createSession(boardId) {
107107
syncRunning = true
108108
await sessionApi.syncSession(boardId, await tokenPromise)
109109
} catch (err) {
110-
if (err.response.status === 404) {
110+
if (err.response?.status === 404) {
111111
// session probably expired, let's
112112
// create a fresh session
113113
create()

0 commit comments

Comments
 (0)