Symfony UX: Turbo
Turbo Stream for Instant Review Update
  Start your All-Access Pass to unlock this challenge
Buy Access Login

Challenge 1 / 1

Following up with my chat message test, I came up with the right stream template to add the new messages to our users chat log.

<turbo-stream action="update" id="new-messages-{{ chat.id }}">
    <template>
        {% for message in chat.newMessages %}
            <div class="message">
                <span class="user">{{ message.from }}</span>:
                {{ message.text }}
            </div>
        {% endfor %}
    </template>
</turbo-stream>

Now, whenever a user submits the form to send a message, I'd like to return an empty form to reset the user's chat and stream the new messages to all chatrooms.

What would the code for this action look like?

Skip challenges and go to theNext Chapter

Turn Challenges Off?

All further challenges will be skipped automatically.
You can re-enable challenges at any time on this page or from your account page.