Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[WebProfilerBundle] Make WDT follow ajax requests if header set#26655
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
gharlan commentedMar 25, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@jeffreymb tested it again and found a problem. When the ajax page triggers immediately another ajax call (without the It is reproducible for me with these controllers: /** * @Route("/") */publicfunctionindexAction():Response {returnnewResponse(<<<'HTML'<html><head></head><body> <a href="/foo">Load /foo</a> <main></main> <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script> <script> $('a').click(function (event) { event.preventDefault(); $('main').load('/foo'); }); </script></body></html>HTML); }/** * @Route("/foo") */publicfunctionfooAction():Response {$response =newResponse(' foo <script>$.get("/bar");</script>');$response->headers->set('Symfony-Debug-Toolbar-Replace',1);return$response; }/** * @Route("/bar") */publicfunctionbarAction():Response {returnnewResponse('',204); } Load index page and click on "Load /foo". After that the ajax block is blinking all the time here. |
jeffreymb commentedMar 25, 2018
@gharlan This PR doesn't (at this point) touch the code that is relevant to the issue you've discovered. Is this for sure in scope for this PR? |
gharlan commentedMar 25, 2018
Without this PR I don't have this issue. |
jeffreymb commentedMar 27, 2018
@gharlan fixed |
gharlan commentedMar 27, 2018
Thanks, it works great! ❤️ In
So maybe you have to copy your changes to this file? I'm not sure. |
jeffreymb commentedMar 27, 2018
I've double checked that none of the changes in this PR are relevant to |
jeffreymb commentedApr 16, 2018
Any chance this can make 4.1? I'm not sure what the policy is, but this PR was created before the feature freeze, and actually most of the work done before the 4.0 feature freeze! |
nicolas-grekas left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Would be great to have a doc PR also.
jeffreymb commentedApr 16, 2018
There is a docs issue:symfony/symfony-docs#8409 |
nicolas-grekas commentedApr 20, 2018
ping @symfony/deciders |
| * added information about orphaned events | ||
| * added ability to auto-refresh the toolbar if a`Symfony-Debug-Toolbar-Replace` header | ||
| is set and has a value of '1' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
extra whitespace at the beginning of the line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
here is what I propose here:
made the toolbar auto-update with info from ajax reponses when they set theSymfony-Debug-Toolbar-Replace header to1
I would have done it myself, but you disallowed me from pushing on your fork :)
| * added information about orphaned events | ||
| * made the toolbar auto-update with info from ajax reponses when they set the | ||
| `Symfony-Debug-Toolbar-Replace header to`1` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Missing ` afterSymfony-Debug-Toolbar-Replace
jeffreymb commentedApr 27, 2018
I created a doc PR earlier today. |
nicolas-grekas commentedApr 29, 2018
Thank you@jeffreymb. |
…eader set (jeffreymb)This PR was squashed before being merged into the 4.1-dev branch (closes#26655).Discussion----------[WebProfilerBundle] Make WDT follow ajax requests if header setReplaces#22509. I accidentally closed that PR and couldn't get GitHub to recognize when I added more commits to the branch in my fork.| Q | A| ------------- | ---| Branch? | master| Bug fix? | no| New feature? | yes <!-- don't forget updating src/**/CHANGELOG.md files -->| BC breaks? | no| Deprecations? | no <!-- don't forget updating UPGRADE-*.md files -->| Tests pass? | yes (There are no tests that I could find)| Fixed tickets |#15456| License | MIT| Doc PR | symfony/symfony-docs#... <!--highly recommended for new features-->When the header of an ajax response contains the `Symfony-Debug-Toolbar-Replace` header with a value of '1' it will automatically update the toolbar with the toolbar with the debug info from the ajax request.The bulk of the code in the `loadToolbar` function in the `base_js.html.twig` file is moved from the `toolbar_js.html.twig` file and slightly refactored to use the internal functions instead of making external calls. I take no credit/blame for this code. 😉If this could make it into 4.1 there are multiple people that would be very happy!Commits-------e4e591b [WebProfilerBundle] Make WDT follow ajax requests if header set
This PR was squashed before being merged into the master branch (closes#9692).Discussion----------WDT following AJAX requestsThis PR is for#8409 and the functionality insymfony/symfony#26655.This is my first Doc PR so I'm happy for all the constrictive input there is to give. I'm really hoping this functionality can make 4.1.Commits-------1bbca83 WDT following AJAX requests
…fig for replace on ajax requests (chr-hertel)This PR was merged into the 7.3 branch.Discussion----------[WebProfilerBundle] Extend web profiler listener & config for replace on ajax requests| Q | A| ------------- | ---| Branch? | 7.3| Bug fix? | no| New feature? | yes| Deprecations? | no| Issues || License | MITBasically a follow up of#26655 to make the feature of replacing the toolbar on ajax requests configurable instead of application side listeners for setting the `Symfony-Debug-Toolbar-Replace` header```yamlwhen@dev: web_profiler: toolbar: ajax_replace: true # <--- intercept_redirects: false```#SymfonyHackdayCommits-------3a723b5 feat: extend web profiler config for replace on ajax requests
Replaces#22509. I accidentally closed that PR and couldn't get GitHub to recognize when I added more commits to the branch in my fork.
When the header of an ajax response contains the
Symfony-Debug-Toolbar-Replaceheader with a value of '1' it will automatically update the toolbar with the toolbar with the debug info from the ajax request.The bulk of the code in the
loadToolbarfunction in thebase_js.html.twigfile is moved from thetoolbar_js.html.twigfile and slightly refactored to use the internal functions instead of making external calls. I take no credit/blame for this code. 😉If this could make it into 4.1 there are multiple people that would be very happy!