Fix DAG list cursor carrying over between environments - #695
Open
jvanbuel wants to merge 2 commits into
Open
Conversation
clear_state(), which resets the view when switching Airflow environments, only cleared each table's underlying data (table.all) and left the filtered view and its TableState behind. The selected index therefore survived the switch; ratatui clamps an out-of-range index to the last row when it renders, so landing in a smaller environment silently parked the cursor on the final DAG rather than at the top. Reset the whole FilterableTable instead, which already clears the items, filtered view, selection, scroll offset, filter and visual mode. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0127jzUgqqy8JVX5RydfQxh8
Filter activation happens inside FilterStateMachine::update() when it sees '/', reached via handle_filter_key(); this wrapper had no callers. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0127jzUgqqy8JVX5RydfQxh8
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughThe change removes ChangesFilterable table state
Estimated code review effort: 1 (Trivial) | ~5 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Switching Airflow environments carried the DAG list cursor over from the previous environment. Landing in an environment with fewer DAGs parked the selection on the last row instead of the top, and the list rendered scrolled to the bottom.
Cause
clear_state()resets the view when switching environments, but only cleared each table's underlying data (table.all). The filtered view and itsTableState— which holds the selected index and scroll offset — survived the switch.Ratatui clamps an out-of-range selection to the last row when it renders (
table.rs:757) and clamps the offset likewise (:998), so nothing rendered incorrectly. The cursor simply ended up somewhere the user never chose.Fix
Reset the whole
FilterableTableinstead of just its data.FilterableTable::new()already clears items, filtered view, selection, scroll offset, filter and visual mode — so this is an assignment rather than a new helper.Note this also resets the filter on an environment switch, which the previous code preserved. That is intentional: a
dag_id=filter written for one environment silently hides DAGs in the next, which is the same class of invisible stale state as the bug itself.Also included
Removes
FilterableTable::activate_filter, which had no callers — filter activation happens insideFilterStateMachine::update()when it sees/, reached viahandle_filter_key().Verification
cargo test --workspace --lib --bins(94 passing),cargo clippy --workspace --all-targets --all-features -- -D warnings, andcargo fmt --all --checkall clean.No regression test added: the fix is now an assignment to
FilterableTable::new(), so a unit test would be exercising the language rather than the logic. A meaningful guard would need anAppfixture at theclear_statelevel.🤖 Generated with Claude Code
https://claude.ai/code/session_0127jzUgqqy8JVX5RydfQxh8
Generated by Claude Code
Summary by CodeRabbit