mirror of
https://github.com/plankanban/planka.git
synced 2025-07-19 05:09:43 +02:00
fix: Subscribe only when needed
This commit is contained in:
parent
b955e933b2
commit
58eda7d555
10 changed files with 28 additions and 23 deletions
|
@ -11,15 +11,17 @@ const createBoard = (projectId, data, headers) =>
|
|||
const createBoardWithImport = (projectId, data, requestId, headers) =>
|
||||
http.post(`/projects/${projectId}/boards?requestId=${requestId}`, data, headers);
|
||||
|
||||
const getBoard = (id, headers) =>
|
||||
socket.get(`/boards/${id}`, undefined, headers).then((body) => ({
|
||||
...body,
|
||||
included: {
|
||||
...body.included,
|
||||
cards: body.included.cards.map(transformCard),
|
||||
attachments: body.included.attachments.map(transformAttachment),
|
||||
},
|
||||
}));
|
||||
const getBoard = (id, subscribe, headers) =>
|
||||
socket
|
||||
.get(`/boards/${id}${subscribe ? '?subscribe=true' : ''}`, undefined, headers)
|
||||
.then((body) => ({
|
||||
...body,
|
||||
included: {
|
||||
...body.included,
|
||||
cards: body.included.cards.map(transformCard),
|
||||
attachments: body.included.attachments.map(transformAttachment),
|
||||
},
|
||||
}));
|
||||
|
||||
const updateBoard = (id, data, headers) => socket.patch(`/boards/${id}`, data, headers);
|
||||
|
||||
|
|
|
@ -9,7 +9,8 @@ const createUser = (data, headers) => socket.post('/users', data, headers);
|
|||
|
||||
const getUser = (id, headers) => socket.get(`/users/${id}`, undefined, headers);
|
||||
|
||||
const getCurrentUser = (headers) => socket.get('/users/me', undefined, headers);
|
||||
const getCurrentUser = (subscribe, headers) =>
|
||||
socket.get(`/users/me${subscribe ? '?subscribe=true' : ''}`, undefined, headers);
|
||||
|
||||
const updateUser = (id, data, headers) => socket.patch(`/users/${id}`, data, headers);
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ export function* fetchBoardByCurrentPath() {
|
|||
tasks,
|
||||
attachments,
|
||||
},
|
||||
} = yield call(request, api.getBoard, boardId));
|
||||
} = yield call(request, api.getBoard, boardId, true));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import api from '../../../api';
|
|||
import mergeRecords from '../../../utils/merge-records';
|
||||
|
||||
export function* fetchCore() {
|
||||
const { item: user } = yield call(request, api.getCurrentUser);
|
||||
const { item: user } = yield call(request, api.getCurrentUser, true);
|
||||
const { items: users1 } = yield call(request, api.getUsers);
|
||||
|
||||
const {
|
||||
|
|
|
@ -62,7 +62,7 @@ export function* handleBoardMembershipCreate(boardMembership) {
|
|||
if (isCurrentUser) {
|
||||
let board2;
|
||||
try {
|
||||
({ item: board2 } = yield call(request, api.getBoard, boardMembership.boardId));
|
||||
({ item: board2 } = yield call(request, api.getBoard, boardMembership.boardId, false));
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ export function* fetchBoard(id) {
|
|||
tasks,
|
||||
attachments,
|
||||
},
|
||||
} = yield call(request, api.getBoard, id));
|
||||
} = yield call(request, api.getBoard, id, true));
|
||||
} catch (error) {
|
||||
yield put(actions.fetchBoard.failure(id, error));
|
||||
return;
|
||||
|
|
|
@ -81,7 +81,7 @@ export function* handleLocationChange() {
|
|||
tasks,
|
||||
attachments,
|
||||
},
|
||||
} = yield call(request, api.getBoard, currentBoard.id));
|
||||
} = yield call(request, api.getBoard, currentBoard.id, true));
|
||||
} catch (error) {} // eslint-disable-line no-empty
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue