Server / page hangs when I have template strings in a script / tag (js-ish) file.
Strange bug. Not sure it's an http-server issue, maybe a bug in a dependency as I can generate the same problem in various server solutions (e.g. reload, lr-http-server, etc.) Anyway, thought maybe someone here might have a better insight. I'm using RiotJS and http-server / watch-http-server to develop. My page stopped responding when I started using template strings in my file.
I'm loading the files in an index.html like this:
What happens is when I include a template string like this in my tag file (comments-mine.tag):
The Network panel gives me a warning: Caution: request is not finished yet!
This hangs the page. Nothing in the browser window will work until the hang frees itself. With one or two of these template string lines, the page will eventually (after a long delay) become responsive again. However, with many of these - the browser will try to kill the page.
I've duplicated this issue in Firefox as well. By simply commenting out the template string and replacing it with string cats, the page loads fine, see image:
Result:
Any ideas where the issue lies?
EDIT: Seems to change the outcome if I add more or less ${} in the line. Or / chars. Or whether it's inside [ ... ]. Something in the way the server is parsing the raw stuff it transfers?
See examples:
Hangs (one ${...})
updates[`comments/public/${comment.id}/`] = comment;
Works
updates[`comments/public/${comment.id}`] = comment;
Hangs (two ${...})
updates[`users/${user.uid}/${comment.id}`] = comment;
Works
updates[`users/${user.uid}/${comment.id}/`] = comment;
Template String Pattern outside of brackets [...]
Works (this pattern hangs if in brackets)
var publicRefStr = `comments/public/${comment.id}/`;
updates[publicRefStr] = comment;
Hangs (two ${...} still)
var userRefStr = `comments/users/${user.uid}/${comment.id}`;
updates[userRefStr] = comment;
Works (two ${...})
var userRefStr = `comments/users/${user.uid}/${comment.id}/`;
updates[userRefStr] = comment;
Pretty confident this isn't an http-server related issue. Feel free to open a re-open this if you can narrow the bug down to something directly http-server related. Thanks!
Yeah. Figured. Any idea as to which dependency might be a good place to start hunting this down?
@jmk2142 something frontend / template related, I'd reckon.