Skip to content

refactor: remove hooks from Parts namespace and add Select.useAsync#147

Open
IzumiSy wants to merge 3 commits intomainfrom
async_component_api_consistency
Open

refactor: remove hooks from Parts namespace and add Select.useAsync#147
IzumiSy wants to merge 3 commits intomainfrom
async_component_api_consistency

Conversation

@IzumiSy
Copy link
Copy Markdown
Contributor

@IzumiSy IzumiSy commented Apr 2, 2026

The Parts namespace (e.g. Combobox.Parts, Autocomplete.Parts) was unintentionally exporting useXxx hooks (useFilter, useAsync, useCreatable) alongside UI primitives. This was never the intended API — Parts should only contain renderable sub-components, while hooks belong at the top-level namespace (e.g. Combobox.useAsync, Autocomplete.useFilter).

This PR corrects that design oversight and adds Select.useAsync for consistency across all dropdown components.

Breaking Changes

This removes useFilter, useAsync, and useCreatable from the Parts namespace.

These hooks were part of the advanced headless composition API, and we have not observed any external usage of them via Parts. The hooks themselves are not removed — they are available at the top-level namespace (e.g. Combobox.useAsync instead of Combobox.Parts.useAsync). Given the low likelihood of impact, we are intentionally shipping this as a breaking change without a deprecation

Changes

API correction: Remove hooks from Parts

  • Combobox.Parts: Removed useFilter, useCreatable, useAsync
  • Autocomplete.Parts: Removed useFilter, useAsync
  • These hooks remain accessible at the top level: Combobox.useAsync, Combobox.useCreatable, Combobox.useFilter, Autocomplete.useAsync, Autocomplete.useFilter

New: Select.useAsync

  • Added Select.useAsync hook for headless async patterns with Select.Parts
  • Refactored Select.Async to use Select.useAsync internally, removing duplicated logic to be consistent with other dropdown component APIs
  • Unlike Combobox.useAsync/Autocomplete.useAsync, Select's version has no query or debounce — it fetches on each dropdown open

Docs

  • Updated Autocomplete.Parts / Combobox.Parts documentation to remove hooks from destructuring examples
  • Added "Async with Parts" examples to all three component docs (Autocomplete, Combobox, Select) showing useAsync + Parts composition with spread syntax

Tests

  • Updated test files to import hooks directly (useAsync, useCreatable) instead of accessing them via the Parts namespace
  • Removed artificial namespace scaffolding objects from test files

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 2, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@tailor-platform/app-shell@147
npm i https://pkg.pr.new/@tailor-platform/app-shell-vite-plugin@147

commit: c196692

@IzumiSy IzumiSy changed the title Update API and docs for dropdown components refactor: remove hooks from Parts namespace and add Select.useAsync Apr 2, 2026
@IzumiSy IzumiSy force-pushed the async_component_api_consistency branch from b5f100d to b8bc86a Compare April 2, 2026 07:44
@IzumiSy IzumiSy marked this pull request as ready for review April 2, 2026 07:45
@IzumiSy IzumiSy force-pushed the async_component_api_consistency branch from b8bc86a to 613a9fb Compare April 2, 2026 07:45
@IzumiSy
Copy link
Copy Markdown
Contributor Author

IzumiSy commented Apr 2, 2026

/review

Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Generated by API Design Review for issue #147

@IzumiSy IzumiSy force-pushed the async_component_api_consistency branch from 86da97f to c196692 Compare April 3, 2026 01:55
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