Skip to content
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

Null error in js console if nav.docx is empty #170

Open
alexkli opened this issue Jan 27, 2023 · 0 comments
Open

Null error in js console if nav.docx is empty #170

alexkli opened this issue Jan 27, 2023 · 0 comments

Comments

@alexkli
Copy link

alexkli commented Jan 27, 2023

Expected Behaviour

No errors if my navigation document is empty (yet).

I like my browser js console clean from framework errors :) But it's a minor issue.

Actual Behaviour

With an empty nav.docx (see below), I see this error in the js console (using localhost:3000 dev server):

failed to load module for header TypeError: Cannot read properties of null (reading 'querySelectorAll')
    at toggleAllNavSections (header.js:44:12)
    at toggleMenu (header.js:60:3)
    at Module.decorate (header.js:138:5)
    at async lib-franklin.js:360:15

This is because this line here does not check if sections is null nor not.

Empty nav.docx: The nav.plain.html seen in the browser looks like this:

<div></div>

Reproduce Scenario (including but not limited to)

Steps to Reproduce

  1. have an empty navigation doc (e.g. nav.docx)
  2. use default boilerplate code
  3. run hlx up
  4. open any page in localhost:3000

Platform and Version

boilerplate: https://github.com/adobe/helix-project-boilerplate/tree/a906cfc82b7a6f807e6a1899fa69a062ade2a0bc

franklin-simulator v14.20.0

Sample Code that illustrates the problem

Standard boilerplate code.

Logs taken while reproducing problem

omprakashgupta1995 referenced this issue in WWWPiramalFinanceCOM/piramalfinance Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant