nodejs.org icon indicating copy to clipboard operation
nodejs.org copied to clipboard

Language toggler code fails on 404 pages

Open Trott opened this issue 5 years ago • 4 comments

  • 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

Trott avatar Feb 25 '20 15:02 Trott

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

XhmikosR avatar Feb 25 '20 15:02 XhmikosR

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.....

Trott avatar Feb 25 '20 23:02 Trott

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.

Trott avatar Feb 25 '20 23:02 Trott

Probably not related, but the rewrite rules were updated recently https://github.com/nodejs/build/pull/2195

nschonni avatar Feb 25 '20 23:02 nschonni

Closing as this behaviour doesn't exist anymore.

ovflowd avatar Mar 12 '23 13:03 ovflowd