You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
useFilteredTestCases should expose a filtered flag for consistent empty-state messaging #558
useFilteredTestCases (added in #545) returns only ReadonlyArray<ExpandedTestCase>, but its sibling useFilteredDocuments returns { results, filtered } where filtered indicates whether any search/tag/status criteria are currently active.
Consumers that use useFilteredTestCases such as the Timeline component being built in #524 cannot distinguish between two different empty states:
"No scenarios were executed" (nothing ran)
"No scenarios match your query and/or filters" (something ran but was filtered out)
This forces consumers to either call useSearch directly (breaking the abstraction that #545 was specifically designed to provide) or show an inaccurate message to the user.
✨ Do you have a proposal for making it better?
Change useFilteredTestCases to return a consistent shape matching useFilteredDocuments:
return{ results, filtered }
The hook already imports useSearch, so deriving filtered requires no new dependencies. The filtered flag can be computed the same way useFilteredDocuments computes it from whether hideStatuses, tagExpression, or a text search query is active.
This keeps the abstraction intact, makes both hooks consistent with each other and unblocks Timeline from showing accurate empty-state messaging without leaking search internals into the component.
Activity