Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Debug toolbar not showing on Symfony exception pages #41305

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

Closed
berkut1 opened this issue May 20, 2021 · 7 comments · Fixed by #41346
Closed

Debug toolbar not showing on Symfony exception pages #41305

berkut1 opened this issue May 20, 2021 · 7 comments · Fixed by #41346

Comments

@berkut1
Copy link

berkut1 commented May 20, 2021

Symfony version(s) affected: 4.4.22-24 (or 4.4.21-24)

Description
After upgrading to Symfony 4.4.24, the Symfony Exception pages no longer have the Debug Toolbar.
4 4 24

How it was in 4.4.19

4 4 19

Maybe a new configuration has been added that I missed?
Thanks.

@mhujer
Copy link
Contributor

mhujer commented May 20, 2021

Same for me - toolbar is not loading and I'm getting Uncaught TypeError: Sfjs.loadToolbar is not a function in Chrome Dev Tools console (on 5.2.8).

EDIT: I guess it may be related to #41168

@derrabus
Copy link
Member

cc @weaverryan

@derrabus
Copy link
Member

Can you please test #41346?

@weaverryan
Copy link
Member

Can you please test #41346?

Yes, I would VERY much appreciate some people validating #41346. I have tested it - but I would like to make sure the bug is definitely fixed :)

@berkut1
Copy link
Author

berkut1 commented May 21, 2021

@derrabus @weaverryan the problem was fixed with changes in the base_js.html.twig
Thanks.

@nicolas-grekas nicolas-grekas modified the milestone: 4.4 May 21, 2021
nicolas-grekas added a commit that referenced this issue May 21, 2021
…d also loading base_js Sfjs if needed (weaverryan)

This PR was merged into the 4.4 branch.

Discussion
----------

[WebProfilerBundle] Wrapping exception js in Sfjs check and also loading base_js Sfjs if needed

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #41305
| License       | MIT
| Doc PR        | Not needed

This bug was introduced in #41168.

Best viewed with: https://github.com/symfony/symfony/pull/41346/files?w=1 - we could also remove the new indentation in `exception.js`.

In that PR, we innocently don't reload `Sfjs` if it doesn't exist. However, on an error page, that template ALSO adds an `Sfjs`, and that `Sfjs` is *smaller* - containing only a subset of the `Sfjs` functions. This is tricky, but this PR fixes it.

Here are the various situations:

1) I hit an exception page. The `Sfjs` from `exception.js` is loaded first. This adds the smaller `Sfjs`. Then the `base_js.html.twig` version is hit. Because `Sfjs` is missing the `loadToolbar()` method, that code DOES run again to reinitialize it.

2) I am on a normal page, then travel to an exception page with Turbo. In this case, the original `Sfjs` from `base_js.html.twig` was processed. Then, on the exception page, the `Sfjs` from `exception.js` is ignored, as is the 2nd execution of `base_js.html.twig`.

Overall, the JS could use some work for supporting things like Turbo (e.g. `DOMContentLoaded` doesn't work with Turbo, so the exception page JS is broken). But I wanted to focus on fixing the bug in this PR.

As a reminder, #41168 (avoiding overriding `Sfjs`) was done to help with the AJAX toolbar and Turbo - it's explained in point (1) on #41168.

Cheers!

Commits
-------

5fa42f1 Wrapping exception js in Sfjs check and also loading base_js Sfjs if needed
@nacesprin
Copy link

What is this icon for, and How can I enable it?
image

@berkut1
Copy link
Author

berkut1 commented Jan 19, 2023

@nacesprin it appears automatically when you use the dump() function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants