mirror of
https://github.com/mattermost/focalboard.git
synced 2024-12-27 13:48:52 +02:00
Cleanup attachToBoard
This commit is contained in:
parent
0b1370ab35
commit
d3e8c5a6d2
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user