Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Fix autocomplete delay text field not accepting text
Browse files Browse the repository at this point in the history
SettingsStore.setValue is async (fire&forget) however getValueAt is cached. Theory was supposed to be that getValueAt local echos, however the animation loop of React is probably just too fast to actually make the local echo happen.

Fixes element-hq/element-web#9907
  • Loading branch information
turt2live committed Jul 15, 2019
1 parent 3806395 commit 345dbce
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export default class PreferencesUserSettingsTab extends React.Component {
autoLaunchSupported: false,
minimizeToTray: true,
minimizeToTraySupported: false,
autocompleteDelay: SettingsStore.getValueAt(SettingLevel.DEVICE, 'autocompleteDelay').toString(10),
};
}

Expand Down Expand Up @@ -98,6 +99,7 @@ export default class PreferencesUserSettingsTab extends React.Component {
};

_onAutocompleteDelayChange = (e) => {
this.setState({autocompleteDelay: e.target.value});
SettingsStore.setValue("autocompleteDelay", null, SettingLevel.DEVICE, e.target.value);
};

Expand Down Expand Up @@ -139,7 +141,7 @@ export default class PreferencesUserSettingsTab extends React.Component {
{minimizeToTrayOption}
{autoLaunchOption}
<Field id={"autocompleteDelay"} label={_t('Autocomplete delay (ms)')} type='number'
value={SettingsStore.getValueAt(SettingLevel.DEVICE, 'autocompleteDelay').toString(10)}
value={this.state.autocompleteDelay}
onChange={this._onAutocompleteDelayChange} />
</div>
</div>
Expand Down

0 comments on commit 345dbce

Please sign in to comment.