Skip to content

Commit e0d0ad0

Browse files
committed
fix(view): diff resolver re-reads state on refresh
Previously the closure captured state at invocation; concurrent mutations (e.g. mship switch) weren't reflected until restart. Falls back to empty paths if the task was closed mid-watch.
1 parent f987421 commit e0d0ad0

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/mship/cli/view/diff.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,13 +347,16 @@ def diff(
347347
from mship.cli._resolve import resolve_or_exit
348348

349349
container = get_container()
350-
state = container.state_manager().load()
350+
state_mgr = container.state_manager()
351351

352-
t = resolve_or_exit(state, task)
352+
t = resolve_or_exit(state_mgr.load(), task)
353353
target_task = t.slug
354354

355355
def _resolver() -> tuple[list[Path], Path | None]:
356-
task_obj = state.tasks[target_task]
356+
fresh_state = state_mgr.load()
357+
task_obj = fresh_state.tasks.get(target_task)
358+
if task_obj is None:
359+
return [], None # task was closed mid-watch
357360
all_paths = [Path(p) for p in task_obj.worktrees.values()]
358361
scope: Path | None = None
359362
if not all_ and task_obj.active_repo is not None and task_obj.active_repo in task_obj.worktrees:

0 commit comments

Comments
 (0)