fix(policies): read a focused group outside the viewport

The post-create View group action can focus a card below the fold. A
paused resource has no initial group data, leaving that card on Loading
without an Edit group action. Keep the focused group active so creation
can lead directly to editing.

Removing this change makes the Policies create-and-Apply test time out
when it opens the new group's More actions menu. Keep it separate from
the shared dialog because it changes the card's polling behaviour.
This commit is contained in:
Zakk committed 2026-10-01 15:12:16 +10:00
1 parent 430de8d49c
commit ddbfffc100
1 file changed
+1 -1
+1 -1
View File
@@ -31,7 +31,7 @@ export type PolicyGroupInput = {
export function usePolicyGroup(input: PolicyGroupInput) {
const {id, health, outbounds, refreshGroups, refreshNodes, source, declaration, selection, paused, focused} = input;
const t = useT();
const control = useGroupControl(id, refreshGroups, refreshNodes, paused);
const control = useGroupControl(id, refreshGroups, refreshNodes, paused && !focused);
// A language switch does not repeat the toast.
const report = useEffectEvent((error: Error) =>
toast('negative', t('policy.actionFailed', {name: control.data?.name ?? input.name, error: actionErrorText(error, t, false)}), {