-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
WDT following AJAX requests #9692
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
.. index:: | ||
single: Profiling: WDT Auto-update after AJAX Request | ||
|
||
How to make the Web Debug Toolbar Auto-upate after AJAX Requests | ||
================================================================ | ||
|
||
For single page applications it is often inconvenient to find the profiler | ||
information for the most recent request. It would be much more convient if it | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider rephrase to:
|
||
the toolbar would show the information from the most recent AJAX request | ||
instead of your initial page load. | ||
|
||
By setting the `Symfony-Debug-Toolbar-Replace` to a value of `1` in the | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
AJAX request, the toolbar will be automatically reloaded for the request. The | ||
header can be set on the response object:: | ||
|
||
$response->headers->set('Symfony-Debug-Toolbar-Replace', 1); | ||
|
||
Only setting the header durring development | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo |
||
------------------------------------------- | ||
|
||
Ideally this header should only be set durring development and not for | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps:
|
||
production. This can be accomplished by setting the header in a | ||
:ref:`kernel.response <component-http-kernel-kernel-response>` event listener:: | ||
|
||
public function onKernelResponse(FilterResponseEvent $event) | ||
{ | ||
$response = $event->getResponse(); | ||
|
||
$response->headers->set('Symfony-Debug-Toolbar-Replace', 1); | ||
} | ||
|
||
.. seealso:: | ||
|
||
Read more Symfony events :ref:`/reference/events`. | ||
|
||
If you are using Symfony Flex, you should define your event listener service in the ``config/services_dev.yml`` file so that it only exists in the ``dev`` environment. | ||
|
||
.. seealso:: | ||
|
||
Read more on creating dev only services :ref:`/configuration/configuration_organization`. |
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.
typo
update