Changes from fix/board-crash-new-feat

This commit is contained in:
gsxdsm
2026-03-02 20:32:56 -08:00
committed by gsxdsm
parent 54d69e907b
commit 4a128efbf4
6 changed files with 117 additions and 17 deletions

View File

@@ -1905,7 +1905,15 @@ export function BoardView({ initialFeatureId }: BoardViewProps) {
selectedFeatureIds={selectedFeatureIds}
onToggleFeatureSelection={toggleFeatureSelection}
onRowClick={(feature) => {
if (feature.status === 'backlog') {
// Running features should always show logs, even if status is
// stale (still 'backlog'/'ready'/'interrupted' during race window)
const isRunning = runningAutoTasksAllWorktrees.includes(feature.id);
const isBacklogLike =
feature.status === 'backlog' ||
feature.status === 'merge_conflict' ||
feature.status === 'ready' ||
feature.status === 'interrupted';
if (isBacklogLike && !isRunning) {
setEditingFeature(feature);
} else {
handleViewOutput(feature);

View File

@@ -431,6 +431,45 @@ export const RowActions = memo(function RowActions({
</>
)}
{/* Running task with stale status (backlog/ready/interrupted but tracked as running).
These features are placed in the in_progress column by useBoardColumnFeatures
but their actual status hasn't updated yet, so no other menu block matches. */}
{!isCurrentAutoTask &&
isRunningTask &&
(feature.status === 'backlog' ||
feature.status === 'ready' ||
feature.status === 'interrupted' ||
feature.status === 'merge_conflict') && (
<>
{handlers.onViewOutput && (
<MenuItem
icon={FileText}
label="View Logs"
onClick={withClose(handlers.onViewOutput)}
/>
)}
<MenuItem icon={Edit} label="Edit" onClick={withClose(handlers.onEdit)} />
{handlers.onSpawnTask && (
<MenuItem
icon={GitFork}
label="Spawn Sub-Task"
onClick={withClose(handlers.onSpawnTask)}
/>
)}
{handlers.onForceStop && (
<>
<DropdownMenuSeparator />
<MenuItem
icon={StopCircle}
label="Force Stop"
onClick={withClose(handlers.onForceStop)}
variant="destructive"
/>
</>
)}
</>
)}
{/* Backlog actions */}
{!isCurrentAutoTask &&
!isRunningTask &&

View File

@@ -115,16 +115,14 @@ export function useBoardFeatures({ currentProject }: UseBoardFeaturesProps) {
// Board view only reacts to events for the currently selected project
const eventProjectId = ('projectId' in event && event.projectId) || projectId;
if (event.type === 'auto_mode_feature_start') {
// Reload features when a feature starts to ensure status update (backlog -> in_progress) is reflected
logger.info(
`[BoardFeatures] Feature ${event.featureId} started for project ${projectPath}, reloading features to update status...`
);
loadFeatures();
} else if (event.type === 'auto_mode_feature_complete') {
// Reload features when a feature is completed
logger.info('Feature completed, reloading features...');
loadFeatures();
// NOTE: auto_mode_feature_start and auto_mode_feature_complete are NOT handled here
// for feature list reloading. That is handled by useAutoModeQueryInvalidation which
// invalidates the features.all query on those events. Duplicate invalidation here
// caused a re-render cascade through DndContext that triggered React error #185
// (maximum update depth exceeded), crashing the board view with an infinite spinner
// when a new feature was added and moved to in_progress.
if (event.type === 'auto_mode_feature_complete') {
// Play ding sound when feature is done (unless muted)
const { muteDoneSound } = useAppStore.getState();
if (!muteDoneSound) {

View File

@@ -1,4 +1,5 @@
import {
memo,
useMemo,
useRef,
useState,
@@ -280,7 +281,7 @@ function VirtualizedList<Item extends VirtualListItem>({
);
}
export function KanbanBoard({
export const KanbanBoard = memo(function KanbanBoard({
activeFeature,
getColumnFeatures,
backgroundImageStyle,
@@ -719,4 +720,4 @@ export function KanbanBoard({
</DragOverlay>
</div>
);
}
});