Commit 578c2e3
committed
minor symfony#61167 [WebProfilerBundle] Increase compatibility of toolbar with Turbo (fritzmg)
This PR was merged into the 6.4 branch.
Discussion
----------
[WebProfilerBundle] Increase compatibility of toolbar with Turbo
| Q | A
| ------------- | ---
| Branch? | 6.4
| Bug fix? | yes
| New feature? | no <!-- if yes, also update src/**/CHANGELOG.md -->
| Deprecations? | no <!-- if yes, also update UPGRADE-*.md and src/**/CHANGELOG.md -->
| Issues | -
| License | MIT
If you use [Turbo](https://turbo.hotwired.dev/) in your Symfony project together with the `symfony/web-profiler-bundle`, there is one little annoyance: after every Turbo Drive navigation, the profiler's toolbar will be always open and the toggle button will not actually open/close it. Only after a full refresh does the button work again.
This is because of the following code:
https://github.com/symfony/symfony/blob/74895de13e0df9f4991d82a9c9cd956aee1c326c/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig#L416-L420
During a Turbo Drive navigation, the global `Sfjs` object will stay (which is fine) - and so will its `this.sfwdt` variable of course. Thus `this.sfwdt` will always contain the reference to the toolbar of the first (non-Drive) request and therefore `this.getSfwdt(token)` will always return that - instead of the new toolbar.
This PR simply removes the `this.sfwdt` variable. Any performance gains from storing the reference to the toolbar is negligible anyway, since `getElementById()` should be fast enough.
Commits
-------
735a5a2 Increase compatibility of debug toolbar compatibility with TurboFile tree
1 file changed
+1
-5
lines changed- src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler
1 file changed
+1
-5
lines changedLines changed: 1 addition & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
413 | 413 | | |
414 | 414 | | |
415 | 415 | | |
416 | | - | |
417 | | - | |
418 | | - | |
419 | | - | |
420 | | - | |
| 416 | + | |
421 | 417 | | |
422 | 418 | | |
423 | 419 | | |
| |||
0 commit comments