Skip to content

Commit

Permalink
Merge pull request #12 from soonaverse/fix/performance_issues
Browse files Browse the repository at this point in the history
  • Loading branch information
adamunchained authored Jul 20, 2023
2 parents 8afa3e9 + 011c6d7 commit c6ed2a1
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 34 deletions.
40 changes: 20 additions & 20 deletions src/app/pages/member/pages/nfts/nfts.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,29 +45,29 @@ export class NFTsPage implements OnInit {
this.isDepositNftVisible = true;
this.cd.markForCheck();
}
});

this.data.member$.pipe(untilDestroyed(this)).subscribe((m) => {
if (m) {
this.filterStorageService.memberNftsFitlers$.next({
sortBy: 'nft_soldOn_desc',
refinementList: {
...this.filterStorageService.memberNftsFitlers$.value.refinementList,
owner: [m.uid],
},
});
this.data.member$.pipe(untilDestroyed(this)).subscribe((m) => {
if (m) {
this.filterStorageService.memberNftsFitlers$.next({
sortBy: 'nft_soldOn_desc',
refinementList: {
...this.filterStorageService.memberNftsFitlers$.value.refinementList,
owner: [m.uid],
},
});

this.config = {
indexName: COL.NFT,
searchClient: this.algoliaService.searchClient,
initialUiState: {
nft: this.filterStorageService.memberNftsFitlers$.value,
},
};
this.config = {
indexName: COL.NFT,
searchClient: this.algoliaService.searchClient,
initialUiState: {
nft: this.filterStorageService.memberNftsFitlers$.value,
},
};

// Algolia change detection bug fix
setInterval(() => this.cd.markForCheck(), 200);
}
// Algolia change detection bug fix
setInterval(() => this.cd.markForCheck(), 200);
}
});
});
}

Expand Down
10 changes: 7 additions & 3 deletions src/app/pages/member/pages/spaces/member-spaces.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { DataService } from '@pages/member/services/data.service';
import { HelperService } from '@pages/member/services/helper.service';
import { Space } from '@build-5/interfaces';
import { ActivatedRoute } from '@angular/router';

@UntilDestroy()
@Component({
Expand All @@ -23,6 +24,7 @@ export class MemberSpacesComponent implements OnInit {
public data: DataService,
public helper: HelperService,
public deviceService: DeviceService,
private route: ActivatedRoute,
) {
this.spaceForm = new FormGroup({
space: new FormControl(''),
Expand All @@ -31,9 +33,11 @@ export class MemberSpacesComponent implements OnInit {
}

ngOnInit(): void {
this.spaceForm.controls.space.valueChanges
.pipe(untilDestroyed(this))
.subscribe(this.onSearchValueChange.bind(this));
this.route.params.subscribe(() => {
this.spaceForm.controls.space.valueChanges
.pipe(untilDestroyed(this))
.subscribe(this.onSearchValueChange.bind(this));
});
}

public onSearchValueChange(): void {
Expand Down
12 changes: 6 additions & 6 deletions src/app/pages/member/pages/tokens/tokens.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,14 @@ export class TokensPage implements OnInit, OnDestroy {
if (obj?.tab === 'staking') {
this.handleFilterChange(FilterOptions.STAKING);
}
});

this.data.member$?.pipe(untilDestroyed(this)).subscribe((obj) => {
if (obj) {
this.listen();
}
this.data.member$?.pipe(untilDestroyed(this)).subscribe((obj) => {
if (obj) {
this.listen();
}
});
this.handleNotMintedWarning();
});
this.handleNotMintedWarning();
}

public handleFilterChange(filter: FilterOptions): void {
Expand Down
10 changes: 5 additions & 5 deletions src/app/pages/member/pages/transactions/transactions.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ export class TransactionsPage implements OnInit, OnDestroy {
this.exportTransactions();
this.cd.markForCheck();
}
});

this.data.member$?.pipe(untilDestroyed(this)).subscribe((obj) => {
if (obj) {
this.listen();
}
this.data.member$?.pipe(untilDestroyed(this)).subscribe((obj) => {
if (obj) {
this.listen();
}
});
});
}

Expand Down

0 comments on commit c6ed2a1

Please sign in to comment.