Language toggler code fails on 404 pages
- URL: https://nodejs.org/fhqwhgads
- Browser version: Chrome 79
- Operating system: macOS Mojave
Language toggler JS code errors on 404 resulting in the thank-a-contributor feature never running, and possibly other issues. The toggler should fail gracefully on 404.
Uncaught TypeError: Cannot read property 'textContent' of null
at main.js:20
at main.js:35
Refs: https://github.com/nodejs/nodejs.org/pull/2635#issuecomment-590908375
@XhmikosR @tniessen
The thing is that I cannot find a way to get the a 404 page locally to reproduce the issue.
AFAICT we just need to check for currentLangElement before this line https://github.com/nodejs/nodejs.org/blob/master/static/js/main.js#L20
The thing is that I cannot find a way to get the a 404 page locally to reproduce the issue.
Looks like it's not failing on the live server anymore either. Weird.....
Looks like it's not failing on the live server anymore either. Weird.....
Oh, it only fails if you leave out the locale (e.g., en) in the URL.
Probably not related, but the rewrite rules were updated recently https://github.com/nodejs/build/pull/2195
Closing as this behaviour doesn't exist anymore.