Skip to content

Conversation

fritzmg
Copy link
Contributor

@fritzmg fritzmg commented Jul 20, 2025

Q A
Branch? 6.4
Bug fix? yes
New feature? no
Deprecations? no
Issues -
License MIT

If you use Turbo 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:

if (!this.sfwdt) {
this.sfwdt = document.getElementById('sfwdt' + token);
}
return this.sfwdt;

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.

@carsonbot carsonbot added this to the 6.4 milestone Jul 20, 2025
@fritzmg fritzmg changed the title Increase compatibility of debug toolbarwith Turbo Increase compatibility of debug toolbar with Turbo Jul 20, 2025
@fritzmg fritzmg changed the title Increase compatibility of debug toolbar with Turbo [WebProfilerBundle] Increase compatibility of debug toolbar with Turbo Jul 20, 2025
@fritzmg fritzmg changed the title [WebProfilerBundle] Increase compatibility of debug toolbar with Turbo [WebProfilerBundle] Increase compatibility of toolbar with Turbo Jul 20, 2025
@nicolas-grekas
Copy link
Member

Thank you @fritzmg.

@nicolas-grekas nicolas-grekas merged commit 578c2e3 into symfony:6.4 Jul 21, 2025
10 of 11 checks passed
@fritzmg fritzmg deleted the patch-1 branch July 21, 2025 07:09
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.

4 participants