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] Add missing Javascript function to prevent undefined function#48037
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
MatTheCat commentedOct 29, 2022
The issue rather comes from the fact So if I don’t even know why there are two flavors of |
PhilETaylor commentedOct 29, 2022
lol you literally just paraphrased what I had already said :)
I guess you could show exceptions with |
MatTheCat commentedOct 29, 2022
Quite the opposite in fact: you’re saying Given |
PhilETaylor commentedOct 29, 2022 • 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.
I did think that, but I like to assume everything in Symfony has a reason to be there and that the code it mostly bug free. Maybe. I assume too much :) So you would propose to remove calls to this function in the
The calls to the function are outside the "if undefined" block, and so they do get called. |
PhilETaylor commentedOct 29, 2022
PR updated now to just that change. |
MatTheCat commentedOct 29, 2022 • 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.
If |
MatTheCat commentedNov 3, 2022
I think every occurrence of Maybe you could change the PR’s title too! |
nicolas-grekas commentedDec 13, 2022
Friendly ping@PhilETaylor |
PhilETaylor commentedDec 13, 2022
Thanks. Yup I know I suck :) I have this one and the Doctrine profiler PR to revisit, it's still on my plate to do both. Sorry for the delay. |
nicolas-grekas commentedApr 17, 2023
Closing as this stalled. Please resubmit when you can. Or maybe@MatTheCat if you're up to? |
MatTheCat commentedApr 21, 2023
I opened#50108 because we missed the big picture in this PR 😅 |
…JavaScript (MatTheCat)This PR was merged into the 5.4 branch.Discussion----------[ErrorHandler] Prevent conflicts with WebProfilerBundle’s JavaScript| Q | A| ------------- | ---| Branch? | 5.4| Bug fix? | yes| New feature? | no| Deprecations? | no| Tickets |Fix#50108| License | MIT| Doc PR | N/AErrorHandler’s `exception.js` and WebProfilerBundle’s `base_js.html.twig` both expose a global `Sfjs` variable, which create conflicts (see linked issue e.g.).As the exception page- does not make use of `Sfjs`- is not extensibleI updated `exception.js` to not create any global scope variable. I also removed `DOMContentLoaded` listeners as the script is run inline at the end of the document.This PR stems from#48037.Hiding whitespaces will produce a much more readable diff.Commits-------e331b28 Do not expose `Sfjs` as it is unused and conflicts with WebProfilerBundle’s
So.... To replicate create a demo app with Symfony 5.4, 6.1, 6.2....
The result is a Javascript error in the console log:
Now, Javascript in the profiler is loaded from two places (and each of these files has a header alerting you to that fact and that changes in one should be considered for the other too)
Both files will only run their definition of the
Sfjsif thetypeof Sfjs === 'undefined'is true... so if one loads before the other then the latter will not redefine theSfjsHowever, what is happening is that the
base_js.html.twigis defining theSfjsobject beforeexception.jsgets a chance - and because theSfjs.createFiltersfunction is not inbase_js.html.twigits not defined and so the error message tells us that.This PR duplicates the method into the
base_js.html.twigversion of theSfjsobject so that it can be called from the code (at the bottom of)exception.jsand thus the console.log error message is now gone.The code provided in this PR is not my code, its direct copy of the code from
exception.js