Skip to content

feat(tui): Broadcast actions to all components - #1922

Merged
gtema merged 2 commits into
mainfrom
openstack_tui2
Aug 7, 2026
Merged

feat(tui): Broadcast actions to all components#1922
gtema merged 2 commits into
mainfrom
openstack_tui2

Conversation

@gtema

@gtema gtema commented Aug 7, 2026

Copy link
Copy Markdown
Owner

Broadcast dispatch sends every action to all ~26 resource components,
not just the active one. Refresh and DescribeApiResponse were never
mode-gated because single-target dispatch used to make that implicit --
now they fan out, firing simultaneous API calls / racing the describe
pane on every navigation and login. Add explicit current_mode ==
B::mode() gates; add one for the selection-derived hooks block too since
it reads get_selected() and has the same shape of bug.

Investigated ConnectedToCloud reaching project/region-select popups
unconditionally: confirmed harmless, each fires exactly one fetch per
login event either way -- left as-is (pre-warm).

Add an end-to-end regression test through the real App::handle_actions
path for the actual reported bug (application-credentials filter seeding
on an inactive view), plus a #[cfg(test)] accessor to read a
GenericResourceView's filter back out for assertions.

seed_filter_from_current_user's "don't clobber an existing value" guard
protects a drilled-down user selection across
CloudChangeScope/SwitchToRegion reconnects (same authenticated user) --
but ConnectToCloud (a genuine cloud switch, different user) hits the
same guard and gets skipped too, since user_id is never empty again
after the first login. Filter stays stuck on the previous cloud's user
forever.

Add reset_filter_on_cloud_switch, run only for ConnectToCloud (split out
from the CloudChangeScope/SwitchToRegion branch, which must keep the old
behavior), overridden to clear user_id so the following
ConnectedToCloud's seed sees an empty filter and re-scopes to the new
cloud's user.

Signed-off-by: Artem Goncharov artem.goncharov@gmail.com

gtema added 2 commits August 7, 2026 15:39
Broadcast dispatch sends every action to all ~26 resource components,
not just the active one. Refresh and DescribeApiResponse were never
mode-gated because single-target dispatch used to make that implicit --
now they fan out, firing simultaneous API calls / racing the describe
pane on every navigation and login. Add explicit current_mode ==
B::mode() gates; add one for the selection-derived hooks block too since
it reads get_selected() and has the same shape of bug.

Investigated ConnectedToCloud reaching project/region-select popups
unconditionally: confirmed harmless, each fires exactly one fetch per
login event either way -- left as-is (pre-warm).

Add an end-to-end regression test through the real App::handle_actions
path for the actual reported bug (application-credentials filter seeding
on an inactive view), plus a #[cfg(test)] accessor to read a
GenericResourceView's filter back out for assertions.

seed_filter_from_current_user's "don't clobber an existing value" guard
protects a drilled-down user selection across
CloudChangeScope/SwitchToRegion reconnects (same authenticated user) --
but ConnectToCloud (a genuine cloud switch, different user) hits the
same guard and gets skipped too, since user_id is never empty again
after the first login. Filter stays stuck on the previous cloud's user
forever.

Add reset_filter_on_cloud_switch, run only for ConnectToCloud (split out
from the CloudChangeScope/SwitchToRegion branch, which must keep the old
behavior), overridden to clear user_id so the following
ConnectedToCloud's seed sees an empty filter and re-scopes to the new
cloud's user.

Signed-off-by: Artem Goncharov <artem.goncharov@gmail.com>
CI failed: Tui::new() -> Terminal::new() always builds
Viewport::Fullscreen, which queries the real terminal size
(backend.size(), an ioctl on stdout / fallback open of /dev/tty) --
absent in a headless CI container, unlike this sandbox's shell where a
real /dev/tty is still reachable through the redirected fd, which is why
it passed locally.

Add Tui::new_for_test(), building Viewport::Fixed instead -- confirmed
via ratatui-core's Terminal::with_options source that the Fixed branch
never calls backend.size(), so construction needs no terminal I/O at
all. Switch all 5 app.rs tests that construct a Tui to use it.

Signed-off-by: Artem Goncharov <artem.goncharov@gmail.com>
@gtema
gtema merged commit b98e24c into main Aug 7, 2026
18 checks passed
@gtema-release-plz gtema-release-plz Bot mentioned this pull request Aug 7, 2026
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.

1 participant