Skip to content

Commit

Permalink
fix: handle OPF submit payment sequence error
Browse files Browse the repository at this point in the history
Closes: CXSPA-9192
  • Loading branch information
Matejk00 authored Jan 20, 2025
1 parent f334ee1 commit 61251c3
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
} from '@spartacus/opf/payment/root';
import { LAUNCH_CALLER, LaunchDialogService } from '@spartacus/storefront';
import { Observable, Subject, lastValueFrom } from 'rxjs';
import { finalize, take } from 'rxjs/operators';
import { finalize, last, take } from 'rxjs/operators';

@Injectable()
export class OpfGlobalFunctionsService implements OpfGlobalFunctionsFacade {
Expand Down Expand Up @@ -236,6 +236,13 @@ export class OpfGlobalFunctionsService implements OpfGlobalFunctionsFacade {
returnPath: undefined,
})
.pipe(
/**
* Needed to to handle empty emissions gracefully without
* triggering a sequence error.
*
* It will resolve with `true` if no values are emitted.
*/
last(() => true, true),
finalize(() => {
if (overlayedSpinner) {
this.stopLoaderSpinner(overlayedSpinner);
Expand Down

0 comments on commit 61251c3

Please sign in to comment.