FIX: Admin setting search debounce losing characters (#27238)

When typing slowly in the admin setting filter input,
we were losing characters after the debounce. This commit
changes to use native <input /> instead of the ember
<Input /> component similar to the change in
bfd6a7b86c

c.f. https://meta.discourse.org/t/settings-filter-loses-some-of-the-letters-you-entered/305201
This commit is contained in:
Martin Brennan 2024-05-29 15:49:44 +10:00 committed by GitHub
parent 963b9fd157
commit 684492f2c5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 25 additions and 20 deletions

View File

@ -23,18 +23,6 @@ export default class AdminPluginFilteredSiteSettings extends Component {
this.filterChanged({ filter: "", onlyOverridden: false });
}
filterSettings(filterData) {
this.args.onFilterChanged(filterData);
this.visibleSettings = this.siteSettingFilter.filterSettings(
filterData.filter,
{
includeAllCategory: false,
onlyOverridden: filterData.onlyOverridden,
}
)[0]?.siteSettings;
this.loading = false;
}
@action
filterChanged(filterData) {
this._debouncedOnChangeFilter(filterData);
@ -54,6 +42,18 @@ export default class AdminPluginFilteredSiteSettings extends Component {
);
}
filterSettings(filterData) {
this.args.onFilterChanged(filterData);
this.visibleSettings = this.siteSettingFilter.filterSettings(
filterData.filter,
{
includeAllCategory: false,
onlyOverridden: filterData.onlyOverridden,
}
)[0]?.siteSettings;
this.loading = false;
}
<template>
<AdminSiteSettingsFilterControls
@onChangeFilter={{this.filterChanged}}

View File

@ -6,7 +6,6 @@ import { action } from "@ember/object";
import didInsert from "@ember/render-modifiers/modifiers/did-insert";
import didUpdate from "@ember/render-modifiers/modifiers/did-update";
import DButton from "discourse/components/d-button";
import TextField from "discourse/components/text-field";
import i18n from "discourse-common/helpers/i18n";
export default class AdminSiteSettingsFilterControls extends Component {
@ -28,6 +27,12 @@ export default class AdminSiteSettingsFilterControls extends Component {
});
}
@action
onChangeFilterInput(event) {
this.filter = event.target.value;
this.onChangeFilter();
}
@action
onToggleOverridden(event) {
this.onlyOverridden = event.target.checked;
@ -57,14 +62,14 @@ export default class AdminSiteSettingsFilterControls extends Component {
class="menu-toggle"
/>
{{/if}}
<TextField
@type="text"
@value={{this.filter}}
placeholder={{i18n "type_to_filter"}}
@onChange={{this.onChangeFilter}}
class="no-blur"
<input
{{on "input" this.onChangeFilterInput}}
id="setting-filter"
class="no-blur admin-site-settings-filter-controls__input"
placeholder={{i18n "type_to_filter"}}
autocomplete="off"
type="text"
value={{this.filter}}
/>
<DButton
@action={{this.clearFilter}}

View File

@ -1,7 +1,7 @@
import Controller from "@ember/controller";
import { action } from "@ember/object";
export default class AdminSiteSettingsController extends Controller {
export default class AdminPluginsShowSettingsController extends Controller {
filter = "";
@action