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

setTheme does not load theme if themePath was not specified in the configuration #247

Closed
DmitryEfimenko opened this issue Jan 6, 2023 · 1 comment · Fixed by #244
Closed

Comments

@DmitryEfimenko
Copy link

Reproduction

Steps to reproduce:

  1. Open this StackBlitz link
  2. Observe that theme was not applied because themePath was not provided in the config.

Expected Behavior

What behavior were you expecting to see?

Theme should be loaded. I think specifying themePath in the configuration should be optional.

The application might have conditional logic for loading theme based on user preferences. There's no need to first load a theme that the user does not need, and then switch to a user-preferred theme.

Actual Behavior

What behavior did you actually see?

Theme is not loaded due to an error.

StackBlitz doesn't provide a good error stack trace. Here's what I get locally:

ERROR TypeError: Cannot set properties of undefined (setting 'href')
at HighlightLoader.setTheme (ngx-highlightjs.mjs:133:36)

This points to this line of code
The _themeLinkElement is undefined because loadTheme, which sets this variable, never got to run

Environment

  • Angular: 15
  • ngx-highlightjs: ^7.0.1
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows
@MurhafSousli MurhafSousli linked a pull request Jan 31, 2023 that will close this issue
@MurhafSousli
Copy link
Owner

Thanks for reporting! here is a fixed stackblitz with v8.0.0

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

Successfully merging a pull request may close this issue.

2 participants