Skip to content

Commit

Permalink
Merge pull request #8090 from michaelchadwick/frontend-5665-admin-use…
Browse files Browse the repository at this point in the history
…rs-offset-bugfix

fix incorrect offset on new Admin->Users queries
  • Loading branch information
dartajax authored Aug 24, 2024
2 parents ff25fbc + 2c3d2cb commit fcce430
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/frontend/app/components/ilios-users.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { service } from '@ember/service';
import { cleanQuery } from 'ilios-common/utils/query-utils';
import { restartableTask, timeout } from 'ember-concurrency';
import { TrackedAsyncData } from 'ember-async-data';
import { cached } from '@glimmer/tracking';
import { tracked, cached } from '@glimmer/tracking';
import { ensureSafeComponent } from '@embroider/util';
import { action } from '@ember/object';
import NewDirectoryUser from './new-directory-user';
Expand All @@ -15,10 +15,13 @@ export default class IliosUsersComponent extends Component {
@service iliosConfig;
@service store;
@service dataLoader;
@tracked query;

searchTypeConfig = new TrackedAsyncData(this.iliosConfig.itemFromConfig('userSearchType'));

constructor() {
super(...arguments);
this.query = this.args.query;
this.searchForUsers.perform();
}

Expand Down Expand Up @@ -53,7 +56,12 @@ export default class IliosUsersComponent extends Component {
@action
setQuery(query) {
this.args.setQuery(query);
this.searchForUsers.perform();
if (query != this.query) {
this.query = query;
this.setOffset(0);
} else {
this.searchForUsers.perform();
}
}

@action
Expand Down

0 comments on commit fcce430

Please sign in to comment.