summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-01-22 16:09:03 -1000
committerPeter Stone <thepeterstone@gmail.com>2026-01-22 16:09:03 -1000
commit77f5f1d7386811d7e57ab595db48dd8fc2c5ca84 (patch)
tree47a7b21b48a4cd4e3a8e4fae8144eb8940cc7444 /internal
parentd359e18fd048dde2cb243b906467e86e0cef7160 (diff)
Fix slice reallocation bug in GetBoards
Diffstat (limited to 'internal')
-rw-r--r--internal/store/sqlite.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/store/sqlite.go b/internal/store/sqlite.go
index f21a004..069313a 100644
--- a/internal/store/sqlite.go
+++ b/internal/store/sqlite.go
@@ -455,7 +455,7 @@ func (s *Store) GetBoards() ([]models.Board, error) {
defer boardRows.Close()
var boards []models.Board
- boardMap := make(map[string]*models.Board)
+ boardMap := make(map[string]int) // Store index, not pointer
for boardRows.Next() {
var board models.Board
@@ -464,8 +464,8 @@ func (s *Store) GetBoards() ([]models.Board, error) {
return nil, err
}
board.Cards = []models.Card{}
+ boardMap[board.ID] = len(boards) // Store index before append
boards = append(boards, board)
- boardMap[board.ID] = &boards[len(boards)-1]
}
if err := boardRows.Err(); err != nil {
@@ -506,8 +506,8 @@ func (s *Store) GetBoards() ([]models.Board, error) {
}
// Add card to the appropriate board
- if board, ok := boardMap[boardID]; ok {
- board.Cards = append(board.Cards, card)
+ if idx, ok := boardMap[boardID]; ok {
+ boards[idx].Cards = append(boards[idx].Cards, card)
}
}