Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6d0684e

Browse filesBrowse files
committed
minor #9692 WDT following AJAX requests (jeffreymb)
This PR was squashed before being merged into the master branch (closes #9692). Discussion ---------- WDT following AJAX requests This PR is for #8409 and the functionality in symfony/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
2 parents 0a40344 + 1bbca83 commit 6d0684e
Copy full SHA for 6d0684e

File tree

2 files changed

+41
-0
lines changed
Filter options

2 files changed

+41
-0
lines changed

‎profiler.rst

Copy file name to clipboardExpand all lines: profiler.rst
+1
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ install the profiler before using it:
2121
profiler/profiling_data
2222
profiler/matchers
2323
profiler/storage
24+
profiler/wdt_follow_ajax

‎profiler/wdt_follow_ajax.rst

Copy file name to clipboard
+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
.. index::
2+
single: Profiling: WDT Auto-update after AJAX Request
3+
4+
How to Make the Web Debug Toolbar Auto-update After AJAX Requests
5+
================================================================
6+
7+
For single page applications it would be more convenient if the toolbar
8+
showed the information for the most recent AJAX request instead of the
9+
initial page load.
10+
11+
By setting the ``Symfony-Debug-Toolbar-Replace`` header to a value of ``1`` in the
12+
AJAX request, the toolbar will be automatically reloaded for the request. The
13+
header can be set on the response object::
14+
15+
$response->headers->set('Symfony-Debug-Toolbar-Replace', 1);
16+
17+
Only Setting the Header During Development
18+
-------------------------------------------
19+
20+
Ideally this header should only be set during development and not for
21+
production. This can be accomplished by setting the header in a
22+
:ref:`kernel.response <component-http-kernel-kernel-response>` event listener::
23+
24+
public function onKernelResponse(FilterResponseEvent $event)
25+
{
26+
$response = $event->getResponse();
27+
28+
$response->headers->set('Symfony-Debug-Toolbar-Replace', 1);
29+
}
30+
31+
.. seealso::
32+
33+
Read more Symfony events :ref:`/reference/events`.
34+
35+
If you are using Symfony Flex, you should define your event listener service in the
36+
``config/services_dev.yml`` file so that it only exists in the ``dev`` environment.
37+
38+
.. seealso::
39+
40+
Read more on creating dev only services :ref:`/configuration/configuration_organization`.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.