From 6729ade1ccd7eb7837ce52d6c2100b744fc80fd9 Mon Sep 17 00:00:00 2001 From: Juan Tejada Date: Fri, 30 Sep 2016 11:46:50 -0700 Subject: [PATCH] fix(tutorial-tips): Recompute pos when theme changes --- src/components/decorators/has-tutorial-tip.es6 | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/decorators/has-tutorial-tip.es6 b/src/components/decorators/has-tutorial-tip.es6 index f7872f01b..eabaa629a 100644 --- a/src/components/decorators/has-tutorial-tip.es6 +++ b/src/components/decorators/has-tutorial-tip.es6 @@ -125,6 +125,11 @@ export default function HasTutorialTip(ComposedComponent, TipConfig) { this._workspaceTimer = setTimeout(this._onTooltipStateChanged, 0); }), ] + this._disposables = [ + NylasEnv.themes.onDidChangeActiveThemes(() => { + this._themesTimer = setTimeout(this._onRecomputeTooltipPosition, 0); + }), + ] window.addEventListener('resize', this._onRecomputeTooltipPosition); // unfortunately, we can't render() a container around ComposedComponent @@ -150,13 +155,13 @@ export default function HasTutorialTip(ComposedComponent, TipConfig) { } componentWillUnmount() { - for (const unlisten of this._unlisteners) { - unlisten(); - } + this._unlisteners.forEach((unlisten) => unlisten()) + this._disposables.forEach((disposable) => disposable.dispose()) window.removeEventListener('resize', this._onRecomputeTooltipPosition); this.tipNode.parentNode.removeChild(this.tipNode); clearTimeout(this._workspaceTimer); + clearTimeout(this._themesTimer); TipsStore.unmountedTip(TipKey); }