Skip to content

Commit

Permalink
emit state change in setter
Browse files Browse the repository at this point in the history
  • Loading branch information
madhur-tandon committed Mar 12, 2022
1 parent 0eb37e1 commit de4cbf0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/searchReplace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ export class SearchReplaceModel extends VDomModel {
return this._isLoading;
}

set isLoading(v: boolean) {
this._isLoading = v;
this.stateChanged.emit();
}

get searchString(): string {
return this._searchString;
}
Expand All @@ -40,7 +45,7 @@ export class SearchReplaceModel extends VDomModel {

async getSearchString(search: string): Promise<void> {
try {
this._isLoading = true;
this.isLoading = true;
const data = await requestAPI<any>(
'?' + new URLSearchParams([['query', search]]).toString(),
{
Expand All @@ -50,7 +55,7 @@ export class SearchReplaceModel extends VDomModel {
this._queryResults = data;
this.stateChanged.emit();
console.log(data);
this._isLoading = false;
this.isLoading = false;
} catch (reason) {
console.error(
`The jupyterlab_search_replace server extension appears to be missing.\n${reason}`
Expand Down

0 comments on commit de4cbf0

Please sign in to comment.