Skip to content

feat: getUiState allows a status string param - #7

Merged
HugoPerard merged 2 commits into
mainfrom
feat/status-matching
Aug 27, 2026
Merged

HugoPerard merged 2 commits into
mainfrom
feat/status-matching

Conversation

@HugoPerard

@HugoPerard HugoPerard commented Aug 26, 2026 •

Copy link
Copy Markdown
Member

getUiState now accepts a status string, so you can chain .match().exhaustive() without a set() callback.

const ui = getUiState(query.status);

or

<>
  {getUiState(query.status)
  .match("pending", () => <Spinner />)
  .match("error", () => <Error />)
  .match("success", () => <Ready />)
  .exhaustive();
</>

The status union is split into a discriminated union, so exhaustive() stays type-safe. There is no payload: when you need data, keep using getUiState((set) => …).

@changeset-bot

changeset-bot Bot commented Aug 26, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 579c577

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@bearstudio/ui-state Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@HugoPerard
HugoPerard force-pushed the feat/status-matching branch 3 times, most recently from 87c46c1 to 915b8bf Compare August 26, 2026 15:55
@HugoPerard
HugoPerard force-pushed the feat/status-matching branch from 915b8bf to 579c577 Compare August 27, 2026 08:28
@HugoPerard
HugoPerard merged commit 3c06462 into main Aug 27, 2026
1 check passed
@HugoPerard
HugoPerard deleted the feat/status-matching branch August 27, 2026 08:50
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