Skip to content

fix(app): clear selection after manual flow#27330

Merged
AlexGaillard merged 1 commit intodirectus:mainfrom
kropsi:dm/fix-clear-selection-after-manual-flow
Apr 28, 2026
Merged

fix(app): clear selection after manual flow#27330
AlexGaillard merged 1 commit intodirectus:mainfrom
kropsi:dm/fix-clear-selection-after-manual-flow

Conversation

@kropsi
Copy link
Copy Markdown
Contributor

@kropsi kropsi commented Apr 28, 2026

Scope

What's changed:

  • Restored selection clear after a manual flow runs from the collection list view sidebar (regressed in Add use-flows composable and refactored flow-sidebar-detail manual flow logic #25962 /
    v11.13.0)
  • Selection is cleared after the trigger request resolves; if the trigger request itself fails (network / 4xx / 5xx) the
    selection is preserved so the user can retry. Note: this matches what the trigger endpoint reports — operation-level
    rejections inside the flow still return HTTP 200, so they are treated as success here, same as pre-v11.13.0 behavior
  • Added two unit tests covering the new behavior

Potential Risks / Drawbacks

  • None identified — single-line additive change on the success path, gated by the existing try

Tested Scenarios

  • Manual flow with selection on collection list view → selection cleared after the trigger request resolves
  • Trigger request rejection (mocked) → selection preserved (user can retry)
  • Existing 15 tests in use-flows.test.ts continue to pass; full suite is 17/17
  • Manual end-to-end test against a local Directus instance (sqlite, seeded test_items collection, manual flow with
    requireSelection: true) confirmed the clear

Review Notes / Questions

  • The fix mirrors the pre-v11.13.0 ordering from batchRefresh in collection.vue: clear, then refresh
  • Placed inside useFlows rather than each caller's onRefreshCallback, since the composable owns the selection ref
  • On the item view, selection defaults to an empty ref in useFlows, so the new line is a no-op there
  • keys for the API call is captured before the clear, so the trigger still uses the right selection

Checklist

  • Added or updated tests
  • Documentation PR created here or not required
  • OpenAPI package PR created here or not required

Fixes #27323

@kropsi kropsi requested a review from AlexGaillard as a code owner April 28, 2026 20:07
@kropsi kropsi force-pushed the dm/fix-clear-selection-after-manual-flow branch from f985693 to 0e7b5fb Compare April 28, 2026 20:18
Copy link
Copy Markdown
Member

@rijkvanzanten rijkvanzanten left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Copy Markdown
Member

@AlexGaillard AlexGaillard left a comment

Choose a reason for hiding this comment

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

Great turn around time 👍 🚀 Thanks @kropsi 😄 and congrats on contrib

@AlexGaillard AlexGaillard merged commit 2830783 into directus:main Apr 28, 2026
71 checks passed
@github-actions github-actions Bot added this to the Next Release milestone Apr 28, 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.

Selection not cleared after running a manual flow on collection list view (regression since v11.13.0 / #25962)

3 participants