Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

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

Sign up
Appearance settings

[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

Merged
nicolas-grekas merged 1 commit intosymfony:masterfromjeffreymb:issue_15456
Apr 29, 2018
Merged

[WebProfilerBundle] Make WDT follow ajax requests if header set#26655

nicolas-grekas merged 1 commit intosymfony:masterfromjeffreymb:issue_15456
Apr 29, 2018

Conversation

@jeffreymb
Copy link
Contributor

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.

QA
Branch?master
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?yes (There are no tests that I could find)
Fixed tickets#15456
LicenseMIT
Doc PRsymfony/symfony-docs#...

When the header of an ajax response contains theSymfony-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 theloadToolbar function in thebase_js.html.twig file is moved from thetoolbar_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!

rvanlaak reacted with hooray emoji
@nicolas-grekasnicolas-grekas added this to the4.1 milestoneMar 24, 2018
@nicolas-grekasnicolas-grekas changed the titleMake WDT follow ajax requests if header set[WebProfilerBundle] Make WDT follow ajax requests if header setMar 24, 2018
@gharlan
Copy link
Contributor

gharlan commentedMar 25, 2018
edited
Loading

@jeffreymb tested it again and found a problem. When the ajax page triggers immediately another ajax call (without the-Replace header), the ajax block in toolbar doesn't stop blinking.

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
Copy link
ContributorAuthor

@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
Copy link
Contributor

Without this PR I don't have this issue.

@jeffreymb
Copy link
ContributorAuthor

@gharlan fixed

@gharlan
Copy link
Contributor

Thanks, it works great! ❤️

Inbase_js.html.twig I found this comment:

This file is partially duplicated in TwigBundle/Resources/views/base_js.html.twig. If you
make any change in this file, verify the same change is needed in the other file.

So maybe you have to copy your changes to this file? I'm not sure.

@jeffreymb
Copy link
ContributorAuthor

I've double checked that none of the changes in this PR are relevant toTwigBundle/Resources/views/base_js.html.twig.

@jeffreymb
Copy link
ContributorAuthor

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!

Copy link
Member

@nicolas-grekasnicolas-grekas left a 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
Copy link
ContributorAuthor

There is a docs issue:symfony/symfony-docs#8409

@nicolas-grekas
Copy link
Member

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'
Copy link
Member

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

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`
Copy link
Contributor

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
Copy link
ContributorAuthor

I created a doc PR earlier today.

@nicolas-grekas
Copy link
Member

Thank you@jeffreymb.

@nicolas-grekasnicolas-grekas merged commite4e591b intosymfony:masterApr 29, 2018
nicolas-grekas added a commit that referenced this pull requestApr 29, 2018
…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
javiereguiluz added a commit to symfony/symfony-docs that referenced this pull requestMay 2, 2018
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
@fabpotfabpot mentioned this pull requestMay 7, 2018
fabpot added a commit that referenced this pull requestJan 15, 2025
…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
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

@fabpotfabpotfabpot requested changes

@javiereguiluzjaviereguiluzjaviereguiluz approved these changes

+1 more reviewer

@srozesrozesroze left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

4.1

Development

Successfully merging this pull request may close these issues.

7 participants

@jeffreymb@gharlan@nicolas-grekas@fabpot@javiereguiluz@sroze@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp