Skip to content

Commit 49ec2bb

Browse files
authored
adding tip about ux-turbo 2.1 change
1 parent 7e3447d commit 49ec2bb

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

sfcasts/turbo/turbo-stream.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,18 @@ render a template called `product/reviews.stream.html.twig`. We don't need to pa
4848
any variables yet, but I'm going to pass an empty second argument because we *do*
4949
need to pass a third argument: a `new TurboStreamResponse()`.
5050

51+
***TIP
52+
In `symfony/ux-turbo` 2.1 and higher, this code has changed. The `TurboStreamResponse`
53+
is no longer needed, but a `setRequestFormat()` call is:
54+
55+
```php
56+
$request->setRequestFormat(TurboBundle::STREAM_FORMAT);
57+
58+
return $this->render('product/reviews.stream.html.twig');
59+
```
60+
61+
***
62+
5163
[[[ code('e75b86c21e') ]]]
5264

5365
Okay first: see the `.stream` in the template name? Yep. That has *no* technical

0 commit comments

Comments
 (0)