Skip to content

fix: board picker uses index into re-fetched list (race condition) #14

@nickmeinhold

Description

@nickmeinhold

Problem

In src/bot/callbacks/newtask-flow.ts, the board selection callback (handleNewTaskBoardCallback) re-fetches the full board list from the API and uses the button's index to resolve which board was selected:

const boards = await client.getBoards(flow.workspacePublicId);
const board = boards[boardIdx];

If a board is added, removed, or reordered between when the picker was rendered and when the user clicks a button, the index may point to the wrong board.

Proposed Fix

Store the board mapping (publicId + name) in the flow object when the picker is first rendered, similar to how lists are already stored:

flow.boards = boards.map(b => ({ publicId: b.publicId, name: b.name }));

Then resolve from flow.boards[boardIdx] in the callback instead of re-fetching.

Context

Flagged during cage-match review of PR #13 by KelvinBitBrawler.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions