-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat: Add debounce on search field and remove included resources #3646
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
Changes from 1 commit
b62eeda
ca779cd
17390f1
37a1175
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,18 @@ | ||
| import Component from '@ember/component'; | ||
| import { debounce } from '@ember/runloop'; | ||
| import { action } from '@ember/object'; | ||
|
|
||
| export default class extends Component { | ||
|
|
||
| debouncePeriod = 1000 // 1 second | ||
|
|
||
| setSearchQueryLazily(value) { | ||
| this.set('searchQuery', value); | ||
| } | ||
|
|
||
| @action | ||
| setSearchQuery(value) { | ||
| debounce(this, this.setSearchQueryLazily, value, this.debouncePeriod); | ||
| } | ||
|
|
||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -117,10 +117,10 @@ export default class extends Route.extend(EmberTableRouteMixin) { | |
| } | ||
|
|
||
| filterOptions = this.applySearchFilters(filterOptions, params, searchField); | ||
|
|
||
iamareebjamal marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
iamareebjamal marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| let queryString = { | ||
| get_trashed : true, | ||
| include : 'tickets,sessions,speakers,owner,organizers,coorganizers,track-organizers,registrars,moderators', | ||
| include : 'general-statistics,owner,organizers,coorganizers,track-organizers,registrars,moderators', | ||
|
||
| filter : filterOptions, | ||
| 'page[size]' : params.per_page || 10, | ||
| 'page[number]' : params.page || 1 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| <div class="ui small icon input search-box"> | ||
| {{input type="text" value=searchQuery placeholder="Search ..." }} | ||
| {{input type="text" value=(readonly searchQuery) keyUp=(action 'setSearchQuery' value="target.value") placeholder="Search ..." }} | ||
| <i class="search icon"></i> | ||
| </div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iamareebjamal I think we should comment it out, As
ticket statisticshave played a crucial role in our tables. We will need it once the DOS issues are resolved?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a git repository, not a college project in a pen drive that something which is needed in the future needs to be commented out instead of deleting. It has the entire history of changes in the repo, any deleted thing can be recovered.
Then it'll add the DOS issue again. When is it a good idea to fetch unbounded one to many relationships of a list of objects? Answer - Never
If it'll need to be added, it'll be completely reimplemented and definitely not work like it was right now