1
0
mirror of https://github.com/mattermost/focalboard.git synced 2024-11-24 08:22:29 +02:00

Update sidebar on any board change

This commit is contained in:
Chen-I Lim 2020-10-21 13:36:53 -07:00
parent 277505e6f9
commit b7205a8a1b

View File

@ -30,7 +30,7 @@ export default class BoardPage extends React.Component<Props, State> {
updateTitleTimeout: number
updatePropertyLabelTimeout: number
private boardListener = new OctoListener()
private workspaceListener = new OctoListener()
constructor(props: Props) {
super(props)
@ -100,7 +100,7 @@ export default class BoardPage extends React.Component<Props, State> {
componentWillUnmount() {
Utils.log(`boardPage.componentWillUnmount: ${this.state.boardId}`)
this.boardListener.close()
this.workspaceListener.close()
document.removeEventListener('keydown', this.undoRedoHandler)
}
@ -160,17 +160,6 @@ export default class BoardPage extends React.Component<Props, State> {
private async attachToBoard(boardId: string, viewId?: string) {
Utils.log(`attachToBoard: ${boardId}`)
if (!this.boardListener.isOpen) {
this.boardListener.open([boardId], (blockId: string) => {
Utils.log(`boardListener.onChanged: ${blockId}`)
this.sync()
})
} else {
this.boardListener.removeBlocks([this.state.boardId])
this.boardListener.addBlocks([boardId])
}
this.sync(boardId, viewId)
}
@ -179,6 +168,11 @@ export default class BoardPage extends React.Component<Props, State> {
Utils.log(`sync start: ${boardId}`)
await workspaceTree.sync()
const boardIds = workspaceTree.boards.map(o => o.id)
this.workspaceListener.open(boardIds, async (blockId) => {
Utils.log(`workspaceListener.onChanged: ${blockId}`)
this.sync()
})
if (boardId) {
const boardTree = new MutableBoardTree(boardId)