feat: expose `hasAttachments` and `isEmpty` state to Composer
This PR exposing hasAttachments and isEmpty state to Composer
[!IMPORTANT] Expose
hasAttachmentsandisEmptystates inComposerIfto conditionally render children based on attachments and emptiness.
- Behavior:
- Exposes
hasAttachmentsandisEmptystates inComposerIfto conditionally render children based on attachments and emptiness.- Updates
useComposerIfinComposerIf.tsxto handlehasAttachmentsandisEmptyconditions.- Documentation:
- Updates
Composer.mdxto includehasAttachmentsandisEmptyin the API reference and examples.This description was created by
for f44ab2d77e590d51111ede8e9cd427350b2bcb68. You can customize this summary. It will automatically update as commits are pushed.
⚠️ No Changeset found
Latest commit: f44ab2d77e590d51111ede8e9cd427350b2bcb68
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
I've been thinking about replacing all the if components with a more generic:
<AssistantIf query={({ composer }) => composer.isEmpty}>
what do you think of this? (it would use useAssistantState under the hood)
this way we don't have to add all sorts of small checks to the Thread/Composer.If primitives
@Yonom
That's an interesting refactor on Composer.If. Makes the simple things simple, and the complex things possible.
It becomes clear, an intuitively way to understand what it is doing through the query, so I strongly agree.
We also don't need to manually manage these things expose and they are entirely controlled by the users, which is a great practice.
replaced by the new AssistantIf API! thanks Harry for the idea! :)