1
0
mirror of https://github.com/mattermost/focalboard.git synced 2024-12-27 13:48:52 +02:00

Cleanup attachToBoard

This commit is contained in:
Chen-I Lim 2020-12-11 12:55:23 -08:00
parent 0b1370ab35
commit d3e8c5a6d2
3 changed files with 16 additions and 7 deletions

View File

@ -126,7 +126,10 @@ class Sidebar extends React.Component<Props, State> {
board,
intl.formatMessage({id: 'Sidebar.delete-board', defaultMessage: 'Delete board'}),
async () => {
this.props.showBoard(nextBoardId)
// This delay is needed because OctoListener has a default 100 ms notification delay before updates
setTimeout(() => {
this.props.showBoard(nextBoardId)
}, 120)
},
async () => {
this.props.showBoard(board.id)

View File

@ -141,7 +141,7 @@ export default class BoardPage extends React.Component<Props, State> {
)
}
private async attachToBoard(boardId?: string, viewId?: string) {
private async attachToBoard(boardId?: string, viewId = '') {
Utils.log(`attachToBoard: ${boardId}`)
if (boardId) {
this.sync(boardId, viewId)

View File

@ -137,14 +137,20 @@ class MutableBoardTree implements BoardTree {
return didChange
}
private setActiveView(viewId: string): void {
let view = this.views.find((o) => o.id === viewId)
if (!view || !viewId) {
Utils.logError(`Cannot find BoardView: ${viewId}`)
private setActiveView(viewId?: string): void {
let view: MutableBoardView | undefined
if (viewId) {
view = this.views.find((o) => o.id === viewId)
if (!view) {
Utils.logError(`Cannot find BoardView: ${viewId}`)
view = this.views[0]
}
} else {
// Default to first view
view = this.views[0]
}
this.activeView = view
this.activeView = view!
// Fix missing group by (e.g. for new views)
if (this.activeView.viewType === 'board' && !this.activeView.groupById) {