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

SF-3120 Replace toPromise with lastValueFrom #2918

Merged
merged 3 commits into from
Dec 19, 2024

Conversation

josephmyers
Copy link
Collaborator

@josephmyers josephmyers commented Dec 18, 2024

This change is Reviewable

@josephmyers josephmyers added the will require testing PR should not be merged until testers confirm testing is complete label Dec 18, 2024
@josephmyers josephmyers marked this pull request as ready for review December 18, 2024 05:47
Copy link

codecov bot commented Dec 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.90%. Comparing base (0ac32be) to head (f9d5bdd).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2918      +/-   ##
==========================================
- Coverage   80.90%   80.90%   -0.01%     
==========================================
  Files         533      533              
  Lines       31201    31200       -1     
  Branches     5082     5077       -5     
==========================================
- Hits        25244    25243       -1     
  Misses       5196     5196              
  Partials      761      761              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pmachapman pmachapman self-requested a review December 18, 2024 18:27
@pmachapman pmachapman self-assigned this Dec 18, 2024
Copy link
Collaborator

@pmachapman pmachapman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple of nits!

Reviewed 11 of 11 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @josephmyers)


src/SIL.XForge.Scripture/ClientApp/src/xforge-common/retrying-request.service.ts line 99 at r1 (raw file):

  private async invoke(options: FetchOptions): Promise<T | undefined> {
    while (!this.canceled && this.status !== 'complete') {
      const online = await lastValueFrom(this.online$.pipe(take(1)));

NIT: This could be simplified as:

const online = await firstValueFrom(this.online$);

Code quote:

const online = await lastValueFrom(this.online$.pipe(take(1)));

src/SIL.XForge.Scripture/ClientApp/src/xforge-common/retrying-request.service.ts line 132 at r1 (raw file):

        take(1)
      )
    );

NIT: This could also be simplified as:

await firstValueFrom(this.online$.pipe(filter(isOnline => isOnline)));

Code quote:

    await lastValueFrom(
      this.online$.pipe(
        filter(isOnline => isOnline),
        take(1)
      )
    );

@josephmyers josephmyers force-pushed the task/remove-toPromise branch from 5b1f10f to b6b79be Compare December 19, 2024 00:14
Copy link
Collaborator Author

@josephmyers josephmyers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two make sense, thanks

Reviewable status: 9 of 11 files reviewed, all discussions resolved (waiting on @pmachapman)


src/SIL.XForge.Scripture/ClientApp/src/xforge-common/retrying-request.service.ts line 99 at r1 (raw file):

Previously, pmachapman (Peter Chapman) wrote…

NIT: This could be simplified as:

const online = await firstValueFrom(this.online$);

Done, thanks


src/SIL.XForge.Scripture/ClientApp/src/xforge-common/retrying-request.service.ts line 132 at r1 (raw file):

Previously, pmachapman (Peter Chapman) wrote…

NIT: This could also be simplified as:

await firstValueFrom(this.online$.pipe(filter(isOnline => isOnline)));

Done

Copy link
Collaborator

@pmachapman pmachapman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 2 of 2 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @josephmyers)

@pmachapman pmachapman added ready to test and removed will require testing PR should not be merged until testers confirm testing is complete labels Dec 19, 2024
@RaymondLuong3 RaymondLuong3 merged commit c2d9918 into master Dec 19, 2024
17 checks passed
@RaymondLuong3 RaymondLuong3 deleted the task/remove-toPromise branch December 19, 2024 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants