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

REFACTOR: removes overwritten properties and duplicates fn #9686

Merged
merged 2 commits into from May 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 0 additions & 2 deletions app/assets/javascripts/admin/components/admin-report.js
Expand Up @@ -59,8 +59,6 @@ export default Component.extend({
forcedModes: null,
showAllReportsLink: false,
filters: null,
startDate: null,
endDate: null,
showTrend: false,
showHeader: true,
showTitle: true,
Expand Down
33 changes: 9 additions & 24 deletions app/assets/javascripts/discourse/app/components/text-field.js
Expand Up @@ -6,9 +6,6 @@ import { next, debounce, cancel } from "@ember/runloop";
const DEBOUNCE_MS = 500;

export default TextField.extend({
_prevValue: null,
_timer: null,

attributeBindings: [
"autocorrect",
"autocapitalize",
Expand All @@ -17,13 +14,22 @@ export default TextField.extend({
"dir"
],

init() {
this._super(...arguments);

this._prevValue = null;
this._timer = null;
},

didReceiveAttrs() {
this._super(...arguments);

this._prevValue = this.value;
},

didUpdateAttrs() {
this._super(...arguments);

if (this._prevValue !== this.value) {
if (this.onChangeImmediate) {
next(() => this.onChangeImmediate(this.value));
Expand Down Expand Up @@ -71,27 +77,6 @@ export default TextField.extend({
}
},

didReceiveAttrs() {
this._super(...arguments);
this._prevValue = this.value;
},

didUpdateAttrs() {
this._super(...arguments);
if (this._prevValue !== this.value) {
if (this.onChangeImmediate) {
next(() => this.onChangeImmediate(this.value));
}
if (this.onChange) {
debounce(this, this._debouncedChange, DEBOUNCE_MS);
}
}
},

_debouncedChange() {
next(() => this.onChange(this.value));
},

@discourseComputed("placeholderKey")
placeholder: {
get() {
Expand Down
2 changes: 0 additions & 2 deletions app/assets/javascripts/discourse/app/controllers/composer.js
Expand Up @@ -95,8 +95,6 @@ export default Controller.extend({
scopedCategoryId: null,
lastValidatedAt: null,
isUploading: false,
allowUpload: false,
uploadIcon: "upload",
topic: null,
linkLookup: null,
showPreview: true,
Expand Down
Expand Up @@ -24,7 +24,6 @@ export default Component.extend({
formats: null,
recurring: null,
advancedMode: false,
isValid: true,
timezone: null,
fromSelected: null,
fromFilled: notEmpty("date"),
Expand Down