Skip to content

Commit 201a363

Browse files
committed
fix(attachments): Don't use currentSession for fetching attachments
When switching pages in Collectives, `currentSession` might still be the session from the last page. The readonly view (`MarkdownContentEditor`) doesn't get a session, so the outdated session is used. Instead, always pass the session from `AttachmentResolver` to `setAttachmentList`. Fixes: nextcloud/collectives#1096 Fixes: nextcloud/collectives#1112 Signed-off-by: Jonas <[email protected]>
1 parent e2ad77e commit 201a363

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/services/AttachmentResolver.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export default class AttachmentResolver {
4747
}
4848

4949
async #updateAttachmentList() {
50-
return setAttachmentList({ documentId: this.#documentId, shareToken: this.#shareToken })
50+
return setAttachmentList({ documentId: this.#documentId, session: this.#session, shareToken: this.#shareToken })
5151
}
5252

5353
/*

src/store/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,11 @@ export const textModule = {
9696
setHeadings({ commit }, value) {
9797
commit(SET_HEADINGS, value)
9898
},
99-
async setAttachmentList({ commit, state }, { documentId, shareToken }) {
99+
async setAttachmentList({ commit }, { documentId, session, shareToken }) {
100100
const response = await axios.post(generateUrl('/apps/text/attachments'), {
101-
documentId: state.currentSession?.documentId ?? documentId,
102-
sessionId: state.currentSession?.id,
103-
sessionToken: state.currentSession?.token,
101+
documentId: session?.documentId ?? documentId,
102+
sessionId: session?.id,
103+
sessionToken: session?.token,
104104
shareToken,
105105
})
106106

0 commit comments

Comments
 (0)