-
-
Notifications
You must be signed in to change notification settings - Fork 73
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
Protect mustache/hogan blocks from being altered by prettier => prevent runtime errors #300
Labels
Projects
Comments
adrienjoly
added a commit
that referenced
this issue
Aug 29, 2020
Spotted |
adrienjoly
added a commit
that referenced
this issue
Aug 29, 2020
(note: found issue #300 while formating with vscode)
adrienjoly
added a commit
that referenced
this issue
Aug 29, 2020
adrienjoly
added a commit
that referenced
this issue
Aug 30, 2020
## Problem Reported by Robert S.: > Hello, I was transferring a bunch of tracks from Playmoss to Openwhyd this am, as that site I believe is shutting down after this weekend. Then, my Open Whyd + Track extension stopped connecting. I reinstalled it, still the same issue. Is there a limit set to how many tracks a user can add to a playlist in one day? ## How to reproduce On Openwhyd v1.34.14 (4294c67) 1. go to any YouTube video page 2. activate the bookmarklet (on your local js console, type: `window.document.body.appendChild(window.document.createElement('script')).src = 'http://localhost:8080/js/bookmarklet.js';`) 3. click on the first thumb => it will open `/post?v=2&embed=1&eId=%2Fyt%2FGwL-COqlauA...` in a dialog/popup window 4. the dialog hangs, with the following error in the JS console: `Uncaught SyntaxError: Unexpected token ','` ## Solution This PR fixes the `Uncaught SyntaxError: Unexpected token ','` error happening when trying to add a track, on `/post?v=2&embed=1&eId=%2Fyt%2FGwL-COqlauA`, by fixing a syntax error caused by an automatic formatting of `postEditV2.html` which added a comma (`,`) after a closing Mustache template. Related to #300. See the `fix` commit in the PR. It also tries to reduce the risk of a "Uncaught ReferenceError: YOUTUBE_API_KEY is not defined" error happening while running bookmarklet test.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In #296, we found that, while reformatting a HTML template that contained mustache/hogan blocks embedded in JavaScript code, prettier broke those blocks, causing bugs in the UI.
For instance, resulting to the following invalid template:
The best workaround I found so far was to add multiline JS comments around those templating elements.
For instance:
=> This workaround prevents prettier from trying to re-format these templating elements.
Let's prevent these kinds of bugs from happening again by protecting these blocks.
Note: we're open for alternative ideas on how to fix this reliably and sustainbly.
The text was updated successfully, but these errors were encountered: