Skip to content

feat: let integrators send a poll with the message by removing the poll-only middleware - #1970

Merged
MartinCupela merged 2 commits into
release-v10from
feat/poll-attach-to-message
Oct 30, 2026
Merged

MartinCupela merged 2 commits into
release-v10from
feat/poll-attach-to-message

Conversation

@MartinCupela

@MartinCupela MartinCupela commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Ticket: https://linear.app/stream/issue/REACT-1441/make-messagecomposerpreviews-composable-like-the-message-action-set

CLA

  • I have signed the Stream CLA (required).
  • Code changes are tested

Description of the changes, What, Why and How?

What: an integrator can now send a composer's poll together with the message's text, attachments and quoted message. Until now the poll always went out as a message of its own, and the drafted text stayed in the composer.

How: remove the poll-only step from the composer's composition chain. This adds no new config field or composer method:

import { POLL_ONLY_COMPOSITION_MIDDLEWARE_ID } from 'stream-chat';

client.config.setSetupFunction('messageComposer', ({ composer }) => {
  composer.compositionMiddlewareExecutor.remove(POLL_ONLY_COMPOSITION_MIDDLEWARE_ID);
});
  • createPollOnlyCompositionMiddleware and POLL_ONLY_COMPOSITION_MIDDLEWARE_ID are now exported, so the step can be removed and put back.
  • The default retainCompositionOnSubmit keeps the composer's contents for a poll only while the poll-only step is installed. Removing the step therefore also clears the composer after the send. Without this, the attachments step would leave out attachments the composer keeps, so they would not be sent.
  • With the default chain, behaviour is the same as before.

Why: the React SDK's composer can show an attached poll next to the text and attachments (GetStream/stream-chat-react#3365). This makes it possible to send them as one message.

Changelog

  • Export the poll-only composition middleware and its id, so a composer can send its poll with the message's text and attachments by removing the middleware.

…ll-only middleware

The poll-only composition middleware, which sends a composer's poll as a
message of its own, is now exported with its id,
POLL_ONLY_COMPOSITION_MIDDLEWARE_ID. Removing it from a composer's
compositionMiddlewareExecutor sends the poll together with the message's
text, attachments and quoted message.

The default retainCompositionOnSubmit now retains for a poll only while
that middleware is installed, so removing it also clears the composer after
the send instead of keeping content that already went out. With the default
chain nothing changes.

@isekovanic isekovanic left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this something an integrator has asked for before ? I think it has additional implications (nothing breaking of course) btu you've probably thought about it more than I have :D

Has the backend been checked with poll_id, attachments and quoted_message_id on the same message ?

…thread

The default retainCompositionOnSubmit now retains only when the poll-only
middleware sends the poll alone: a poll is set, the composer is not editing a
message or composing a thread reply, and the middleware is installed.
Previously, updating a message that has a poll kept the composer in edit mode
with the edited text, and a thread reply carrying a poll kept its content.
@MartinCupela

Copy link
Copy Markdown
Contributor Author

Is this something an integrator has asked for before ? I think it has additional implications (nothing breaking of course) btu you've probably thought about it more than I have :D

Has the backend been checked with poll_id, attachments and quoted_message_id on the same message ?

Yes, it works. There is no blocking from the server side.

@isekovanic isekovanic left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Update the ai docs as well when you have the chance to, I think the info there might be stale

@MartinCupela
MartinCupela merged commit b515849 into release-v10 Oct 30, 2026
4 checks passed
@MartinCupela
MartinCupela deleted the feat/poll-attach-to-message branch October 30, 2026 15:23
github-actions Bot pushed a commit that referenced this pull request Nov 2, 2026
## [10.0.0-rc.29](v10.0.0-rc.28...v10.0.0-rc.29) (2026-11-02)

### Features

* let integrators send a poll with the message by removing the poll-only middleware ([#1970](#1970)) ([b515849](b515849)), closes [GetStream/stream-chat-react#3365](GetStream/stream-chat-react#3365)
@stream-ci-bot

Copy link
Copy Markdown

🎉 This PR is included in version 10.0.0-rc.29 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants