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

Mermaid graph with no parameters defined in hugo config results in 'Uncaught TypeError' #1882

Closed
chulcher opened this issue Feb 29, 2024 · 3 comments · Fixed by #1885
Closed
Assignees
Labels
bug Something isn't working e0-minutes Effort < 60 min

Comments

@chulcher
Copy link

var params = {{ .Site.Params.mermaid | jsonify | safeJS }};

If nothing is defined in hugo.toml for [params.mermaid] then the referenced code results in var params = null being generated.

if (defaultConfig.hasOwnProperty(key) && params.hasOwnProperty(keyLower)) {

Then when attempting the if statement a call is made against a null value, resulting in the browser console error.

Uncaught TypeError: Cannot read properties of null (reading 'hasOwnProperty')

@chulcher
Copy link
Author

The error in the script results in per-diagram theme settings breaking and no diagram being generated. An empty set of parameters in hugo.toml (i.e., simply adding [params.mermaid] with no further parameters) assigns an empty set to params and allows successful execution of the script.

@chalin
Copy link
Collaborator

chalin commented Mar 6, 2024

@deining - could you take a look?

@deining
Copy link
Collaborator

deining commented Mar 6, 2024

@deining - could you take a look?

Sure. PR 1885 fixes this issue.

@deining deining added bug Something isn't working e0-minutes Effort < 60 min and removed needs-triage labels Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working e0-minutes Effort < 60 min
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants