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

Cannot read property 'setTheme' of undefined #2220

Closed
kind-serge opened this issue Jun 12, 2019 · 5 comments · Fixed by #2222
Closed

Cannot read property 'setTheme' of undefined #2220

kind-serge opened this issue Jun 12, 2019 · 5 comments · Fixed by #2222
Assignees
Labels
type/bug Something is misbehaving
Milestone

Comments

@kind-serge
Copy link

Hi, we've had such code:

this.terminal.setOption('theme', ....);
this.terminal.open(....);

However, with the latest changes, the internal _colorManager gets initialized on .open(), thus the first line fails with:

TypeError: Cannot read property 'setTheme' of undefined
    at e._setTheme (Terminal.js.pre-build-optimizer.js:587)
    at e.setOption (Terminal.js.pre-build-optimizer.js:307)
    at t.setOption (Terminal.js.pre-build-optimizer.js:193)

It's an easy fix on our side (just swap two lines), however, it makes sense to decouple visual customization from connectivity responsibilities. Was it an unintentional change?

@Tyriar
Copy link
Member

Tyriar commented Jun 12, 2019

I think this is already fixed in the latest release https://github.com/xtermjs/xterm.js/releases/tag/3.14.2, #2179

@kind-serge
Copy link
Author

@Tyriar, it's a new unresolved issue.
If you look at line 622 in Terminal.ts in master - that's the only place where _colorManager is initialized - the open function.

@Tyriar Tyriar reopened this Jun 13, 2019
@Tyriar
Copy link
Member

Tyriar commented Jun 13, 2019

Thanks for the follow up, fixing now 😃

@Tyriar Tyriar added type/bug Something is misbehaving and removed duplicate labels Jun 13, 2019
@Tyriar Tyriar self-assigned this Jun 13, 2019
@Tyriar Tyriar added this to the 4.0.0 milestone Jun 13, 2019
Tyriar added a commit to Tyriar/xterm.js that referenced this issue Jun 13, 2019
@kind-serge
Copy link
Author

Thank you for making it real :)

@Tyriar
Copy link
Member

Tyriar commented Jun 13, 2019

We should be able to entirely avoid these issues when this part is moved to TS strict mode, can't wait but it's a bit of a beast of a project #1507

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Something is misbehaving
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants