DEV Community

Discussion on: Building Star Wars Crawler with Azure Static Web Apps - Part 3

Collapse
 
sitespeed profile image
Tim Moss

Just in case anyone else has the same issue.

I hit a strange and somewhat nasty problem working through this example.
At some point, when I cut and paste the intro.js file from here into VS Code,
the text got subtly reformatted.

Every line of the code was prefixed with a single space

  • maybe to line up with the */ at the end of the "header" comment.

Unfortunately this meant that some of the code didn't work/trigger as expected.
e.g. the star-field worked, but the start button, scrolling/crawling of the text did not!

Since the only diffence in the code was this preceding space on each line it was pretty tricky to spot!
Was using "Inspect" function in Edge comparing my SWA and Glaucia's working SWA

  • seaping between 2 tabs showed the JS code moving left and right by once space (otherwise identical)

Not sure if this is a common thing or down to some extension I have in VS Code trying to be a bit too clever!

Thanksfully it was easy to fix once I found it.

  • Turn on "column editing mode" in VS Code
  • Select the "column" of unwanted spaces
  • Delete then save the file
  • recommit and syncrhonise
  • Boom! the static web app worked as expected