Skip to content

Commit 888d192

Browse files
committed
Fix race condition in Boards/threads loading?
1 parent e788a64 commit 888d192

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

Wired/Boards/Board.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@ public class Board: ConnectionObject {
4444
public func addThread(_ thread:BoardThread) {
4545
self.threads.append(thread)
4646

47-
self.threadsByUUID[thread.uuid] = thread
47+
//self.threadsByUUID[thread.uuid] = thread
4848
}
4949
}

Wired/Boards/BoardsController.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ public class BoardsController: ConnectionObject, ConnectionDelegate {
4545

4646
queue.async(flags: .barrier, execute: {
4747
board.threads = []
48-
board.threadsByUUID = [String:BoardThread]()
4948

5049
})
5150

Wired/Boards/ThreadsViewController.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,17 @@ class ThreadsViewController: ConnectionViewController, NSTableViewDelegate, NSTa
4646
}
4747

4848
if b != nil {
49-
self.boardsController.loadThreads(forBoard: b)
49+
if b.threads.count == 0 {
50+
self.boardsController.loadThreads(forBoard: b)
51+
}
5052

5153
} else {
5254
self.postsViewController.board = nil
5355
self.postsViewController.thread = nil
5456

55-
self.threadsTableView.reloadData()
5657
}
58+
59+
self.threadsTableView.reloadData()
5760
}
5861
}
5962
}

0 commit comments

Comments
 (0)