Skip to content

fix: close results view before switching projects - #165

Merged
boscorat merged 1 commit into
masterfrom
160-bug-switching-projects-with-pending-batch
Aug 26, 2026
Merged

fix: close results view before switching projects#165
boscorat merged 1 commit into
masterfrom
160-bug-switching-projects-with-pending-batch

Conversation

@boscorat

Copy link
Copy Markdown
Owner

Fixes #160 — switching projects while a batch import is pending no longer disables all navigation buttons.

Problem

When the results view is active (import running or batch not yet committed/abandoned), show_results() disables all four nav buttons. Switching projects via the combo box never re-enabled them, leaving the user stuck until restart.

Fix

Added a guard at the top of StanPresenter.update_current_project_info() that checks if the results view is the active content panel and, if so, calls hide_results() to re-enable nav buttons and navigate back to the Import panel before proceeding with the project switch.

This is safe because:

  • hide_results() re-enables nav and navigates to Import — exactly the reset needed
  • clear_for_project_change() (called shortly after) clears in-memory results for the old project
  • The DB batch record is preserved, so switching back still triggers session restore / stale-lock detection

Testing

  • ruff check, ruff format --check, pyrefly check — all pass
  • 95 unit tests — all pass

@boscorat boscorat linked an issue Aug 26, 2026 that may be closed by this pull request
@boscorat
boscorat requested a lite review from Copilot August 26, 2026 19:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new guard runs on all update_current_project_info() calls (including project_db_updated), which can close the Results panel even when no project switch occurred, diverging from the stated intent and potentially causing surprising UI behavior.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Fixes a UI navigation lock-up where switching projects while the Results panel is active (pending batch/import flow) can leave navigation buttons disabled by ensuring the Results panel is closed before proceeding with the project update.

Changes:

  • Added a guard in StanPresenter.update_current_project_info() to detect the active Results view and call hide_results() before switching project state.
File summaries
File Description
src/openstan/presenters/stan_presenter.py Ensures Results panel is closed (re-enabling nav) before project switch logic runs.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/openstan/presenters/stan_presenter.py Outdated
@boscorat
boscorat force-pushed the 160-bug-switching-projects-with-pending-batch branch from 5af9287 to 2f42112 Compare August 26, 2026 19:52
@boscorat
boscorat merged commit 052ffa8 into master Aug 26, 2026
2 checks passed
@boscorat
boscorat deleted the 160-bug-switching-projects-with-pending-batch branch August 26, 2026 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: switching projects with pending batch

2 participants