fix(jira): emitir card.moved al cambiar columna + adaptive indicator polling
Bug: handleMoveCard solo emitia board.invalidated. Dispatcher mapeaba a update() (PUT summary/description/labels) NUNCA a transition(), asi que mover una card en kanban no transicionaba su Jira issue de columna. Solo los labels reflejaban el cambio. Fix backend (handlers.go): - handleMoveCard ahora lee column_id antes del MoveCard. Si la card crusa columnas (prev != new) publica 'card.moved' antes de 'board.invalidated'. El dispatcher reconoce 'card.moved' y ejecuta transition() -> Jira status cambia + labels sincronizan. - Reorder dentro de la misma columna sigue como antes: solo board.invalidated para refetch del cliente sin tocar Jira. - nuevo helper db.lookupCardColumnID(cardID). UX frontend (JiraSyncIndicator): - Polling adaptativo: 5s steady, 1s mientras inflight=true. El usuario VE el yellow durante el sync. - Listener de window CustomEvent 'kanban-card-moved' (cardId match) que fuerza un refetch inmediato (~150ms) tras drop. App.tsx dispara el evento tras api.moveCard resolve. Yellow visible casi instantaneo en lugar de esperar al proximo tick steady.
This commit is contained in:
@@ -229,6 +229,24 @@ func (db *DB) listColumnsByName() (map[string]Column, error) {
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// lookupCardColumnID returns the current column_id for a card, or "" if the
|
||||
// card does not exist. Used by handleMoveCard to detect column changes vs
|
||||
// same-column reorders before publishing card.moved events.
|
||||
func (db *DB) lookupCardColumnID(cardID string) (string, error) {
|
||||
var col sql.NullString
|
||||
err := db.conn.QueryRow(`SELECT column_id FROM cards WHERE id = ?`, cardID).Scan(&col)
|
||||
if err == sql.ErrNoRows {
|
||||
return "", nil
|
||||
}
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if !col.Valid {
|
||||
return "", nil
|
||||
}
|
||||
return col.String, nil
|
||||
}
|
||||
|
||||
// findCardByJiraKey returns the id of the card linked to jiraKey, or "" if
|
||||
// no card carries that link. The lookup ignores soft-deleted cards.
|
||||
func (db *DB) findCardByJiraKey(jiraKey string) (string, error) {
|
||||
|
||||
Reference in New Issue
Block a user