Skip to content

Commit

Permalink
fix: handle OPF submit payment sequence error
Browse files Browse the repository at this point in the history
  • Loading branch information
Matejk00 committed Jan 10, 2025
1 parent 89151c1 commit 86926ba
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 86926ba

Please sign in to comment.