Commit 9d42463
committed
minor #2694 [Turbo] Pass
This PR was merged into the 2.x branch.
Discussion
----------
[Turbo] Pass `turbo_stream_listen` topics to mercure if not defined
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| Docs? | no
| Issues | See below
| License | MIT
Currently, the documentation says:
`"If you're using a private hub, you can add { withCredentials: true } as the third argument to turbo_stream_listen() to authenticate with the hub."`
However, this doesn’t actually work because the cookie is not created.
See: [MercureExtension.php#L75](https://github.com/symfony/mercure/blob/304cf84609ef645d63adc65fc6250292909a461b/src/Twig/MercureExtension.php#L75)
To make it work, we need to explicitly specify the topics again. The working call looks like this:
`turbo_stream_listen("topics", "default", { subscribe: 'topics', withCredentials: true }`
So I updated the implementation, adding the `subscribe` key if it's not already defined.
My mistake, sorry 😅
Commits
-------
f556d2a Pass topics to mercure if not definedturbo_stream_listen topics to mercure if not defined (Fan2Shrek)1 file changed
+5
-3
lines changedLines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
69 | 68 | | |
70 | | - | |
71 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
72 | 72 | | |
| 73 | + | |
| 74 | + | |
73 | 75 | | |
74 | 76 | | |
75 | 77 | | |
| |||
0 commit comments