Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ai/rsc: Make RSC streamable utils chainable #1479

Merged
merged 1 commit into from May 12, 2024
Merged

ai/rsc: Make RSC streamable utils chainable #1479

merged 1 commit into from May 12, 2024

Conversation

shuding
Copy link
Member

@shuding shuding commented May 2, 2024

It's super handy to make RSC streamable primitives chainable to create values inline. For example, unify type definitions with inline streamable values:

if (loggedIn) {
  const userCard = createStreamableUI()

  // LLM logic to update `userCard`...

  return {
    display: userCard.value
  }
} else {
  return {
    display: createStreamableUI().done(<div>Please login</div>).value
  }
}

@MaxLeiter MaxLeiter merged commit 8439884 into main May 12, 2024
6 checks passed
@MaxLeiter MaxLeiter deleted the shu/24e5 branch May 12, 2024 00:54
@JClackett
Copy link

has this been released? it seems to work but the types say I cant chain yet?

@unstubbable
Copy link
Contributor

We might need explicit type annotations here, since tsup is now inferring any as return type for update/append/error/done. This is also the case with the experimentalDts option.

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.

None yet

4 participants