Skip to content

observeOnce should use ES Observable call pattern #2989

@compulim

Description

@compulim

Version

4.8.0

Describe the bug

In core/src/sagas/effects/observeOnce.js, the call pattern for Observable.subscribe is using older format (RxJS) instead of ES Observable.

The new signature is being used in observeEach.js.

This is causing test running in Jest not able to subscribe to the value correct.

The correct one is:

- subscription = observable.subscribe(resolve, reject, resolve);
+ subscription = observable.subscribe({
+   complete: resolve,
+   error: reject,
+   next: resolve
+ })

Steps to reproduce

  1. Write a test using Jest to call DIRECT_LINE/POST_ACTIVITY, and expect DIRECT_LINE/POST_ACTIVITY_FULFILLED

Expected behavior

The POST_ACTIVITY_FULFILLED action should be dispatched back.

Instead, since observeOnce is not working under Jest + Node.js and failed silently, the DIRECT_LINE/POST_ACTIVITY_FULFILLED is never dispatched. Instead, it dispatched POST_ACTIVITY_REJECTED.

Additional context

Tagging @youyu16.

[Bug]

Metadata

Metadata

Assignees

Labels

bugIndicates an unexpected problem or an unintended behavior.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions