-
Notifications
You must be signed in to change notification settings - Fork 18
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
Fix Safari runtime error for..of weirdness #55
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's super weird! Thanks for the fix!
for (const token of parse(node.textContent)) { | ||
const parsed = parse(node.textContent) | ||
for (let i = 0; i < parsed.length; i += 1) { | ||
const token = parsed[i] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small comment: Do you think a code comment with a link to this PR for context would be helpful?
I'd be a little worried that someone sees this code and refactors it back to for const ... in
, resulting in a regression.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sounds like a great idea!
I'll merge this once a comment is added 😝
@keithamus I think this is ready now 🙌🏼 thanks for your help! |
Will a new version be coming out soon :) we're currently pointed to a fork to get this patch, but we would love to point back upstream when this is released! |
Hey @keithamus just checking in to see if there were any plans to do an npm release that includes this update. |
Oh sorry! This one slipped by 😬. Should be out as |
No worries @keithamus ! Just a heads up - looks like there were some pathing mismatches with your latest publish. I'll be sure to throw an issue up (and may be able to help get it fixed, time permitting), but here's the short of it:
Workaround: |
Oh no 🙈. We seem to be having some publish difficulties. I'll make sure to get these resolved soon! |
We've been using template-parts in our new video player project over at Mux.
We really like it with the added utilities of jtml!
Today we ran into a rather strange runtime error only in Safari and it only happens when the web inspector is not open.
Try loading this page with and without web inspector open, might need a few reloads:
https://elements-demo-nextjs-git-fork-luwes-better-errors-mux.vercel.app/MuxPlayer
This refers to this line:
https://github.com/github/template-parts/blob/main/src/template-instance.ts#L28
I don't think the code is wrong here but Safari definitely misinterprets it somehow.
Changing the for..of loop to a regular for loop fixes the issue,
I also tried to store the result of the parse() function in a variable first and use the for..of loop but that didn't fix it :(
Mac OS 12.3
Safari 15.4