From 2ac15b2f7c3bdd2764c97383e671078b617d7afc Mon Sep 17 00:00:00 2001 From: Jon Schneider Date: Mon, 18 Mar 2019 16:57:52 -0500 Subject: [PATCH] fix(artifacts): Fix SpEL text input used in React components (#6712) --- .../core/src/widgets/spelText/SpelText.tsx | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/app/scripts/modules/core/src/widgets/spelText/SpelText.tsx b/app/scripts/modules/core/src/widgets/spelText/SpelText.tsx index a62c632a67c..603845f3bbd 100644 --- a/app/scripts/modules/core/src/widgets/spelText/SpelText.tsx +++ b/app/scripts/modules/core/src/widgets/spelText/SpelText.tsx @@ -44,20 +44,20 @@ export class SpelText extends React.Component { this.renderSuggestions(); } - public componentDidUpdate() { - this.renderSuggestions(); + public componentDidUpdate(_: Readonly, prevState: Readonly): void { + if (prevState.textcompleteConfig !== this.state.textcompleteConfig) { + this.renderSuggestions(); + } } private renderSuggestions() { const input = $(this.spelInputRef.current); - if (!input.attr('contenteditable')) { - input.attr('contenteditable', 'true'); - input.textcomplete(this.state.textcompleteConfig, { - maxCount: 1000, - zIndex: 9000, - dropdownClassName: 'dropdown-menu textcomplete-dropdown spel-dropdown', - }); - } + input.attr('contenteditable', 'true'); + input.textcomplete(this.state.textcompleteConfig, { + maxCount: 1000, + zIndex: 9000, + dropdownClassName: 'dropdown-menu textcomplete-dropdown spel-dropdown', + }); } public render() {