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

feat(Observable): RxJS doesn't even lift. #7202

Merged
merged 1 commit into from Mar 9, 2023

Conversation

benlesh
Copy link
Member

@benlesh benlesh commented Mar 1, 2023

Removes lift, source, and operator from the Observable API. These have been deprecated for more than 3 years. It's time.

#7201

@benlesh benlesh force-pushed the maybe-remove-lift branch 2 times, most recently from 5bd1e2e to d9caf67 Compare March 2, 2023 15:22
@benlesh benlesh marked this pull request as ready for review March 2, 2023 15:22
@benlesh benlesh changed the title WIP: Maybe remove lift? feat(Observable): RxJS doesn't even lift. Mar 2, 2023
+ Removes `lift`, `source`, and `operator` from `Observable`
+ Updates related code

BREAKING CHANGE: `Observable#lift`, `Observable#source`, and `Observable#operator` is no longer a part of the API. These were never meant to be public and have been deprecated for more than 3 years.

Resolves ReactiveX#7201
@demensky
Copy link
Contributor

demensky commented Mar 2, 2023

image

@@ -108,7 +100,7 @@ export class Subject<T> extends Observable<T> implements SubscriptionLike {

/** @internal */
protected _subscribe(subscriber: Subscriber<T>): Subscription {
this._throwIfClosed();
// this._throwIfClosed();
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any additional change planned?

Suggested change
// this._throwIfClosed();

Comment on lines 9 to 11
export function operate<T, R>(
init: (liftedSource: Observable<T>, subscriber: Subscriber<R>) => (() => void) | void
): OperatorFunction<T, R> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
export function operate<T, R>(
init: (liftedSource: Observable<T>, subscriber: Subscriber<R>) => (() => void) | void
): OperatorFunction<T, R> {
export function operate<T, R>(
init: (source: Observable<T>, subscriber: Subscriber<R>) => (() => void) | void
): OperatorFunction<T, R> {

Probably JSDoc should also be updated.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll address this in a followup.

@@ -17,16 +9,5 @@ export function hasLift(source: any): source is { lift: InstanceType<typeof Obse
export function operate<T, R>(
init: (liftedSource: Observable<T>, subscriber: Subscriber<R>) => (() => void) | void
): OperatorFunction<T, R> {
return (source: Observable<T>) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Well, the file name is no longer true.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll address this in a followup.

@benlesh benlesh added AGENDA ITEM Flagged for discussion at core team meetings 8.x Issues and PRs for version 8.x labels Mar 7, 2023
@benlesh
Copy link
Member Author

benlesh commented Mar 8, 2023

CORE TEAM: Approval from core team. No one wants to review it. Ben will just have to trust @demensky.

@kolodny said he'll try. But also that Netflix doesn't review code.

@benlesh
Copy link
Member Author

benlesh commented Mar 8, 2023

I blame @jayphelps

@jayphelps
Copy link
Member

@benlesh so do I.

protected _subscribe(subscriber: Subscriber<any>): TeardownLogic {
return this.source?.subscribe(subscriber);
protected _subscribe(_subscriber: Subscriber<any>): TeardownLogic {
return;
Copy link
Member

Choose a reason for hiding this comment

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

Can we just use an empty body here?

@@ -237,7 +237,7 @@ describe('delay', () => {
const result = e1.pipe(
repeatWhen((notifications) => {
const delayed = notifications.pipe(delay(t));
subscribeSpy = sinon.spy((delayed as any)['source'], 'subscribe');
subscribeSpy = sinon.spy(notifications as any, 'subscribe');
Copy link
Member

Choose a reason for hiding this comment

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

Small nit but I believe you can do sinon.spy<any>(notifications) instead

observer.complete();
return {
unsubscribe() {
// noop
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to verify this was called? If not can we remove this?

@benlesh benlesh merged commit e0bdccf into ReactiveX:master Mar 9, 2023
@benlesh benlesh deleted the maybe-remove-lift branch March 9, 2023 02:09
benlesh added a commit to benlesh/rxjs that referenced this pull request Apr 15, 2023
+ Inlines all operator function creation as just arrow functions. After `lift` was removed, there is no use for the `operate` function.

Related ReactiveX#7202
@benlesh benlesh mentioned this pull request Apr 15, 2023
benlesh added a commit that referenced this pull request Apr 17, 2023
* refactor: Remove `operate` function

+ Inlines all operator function creation as just arrow functions. After `lift` was removed, there is no use for the `operate` function.

Related #7202

* refactor(find): reduce complexity in function calls

+  Removes use of higher-order function, as it's no longer necessary, because we're not using `operate`, because we don't even `lift`.

* refactor(scan/reduce): reduce complexity in function calls

+  Removes use of higher-order function, as it's no longer necessary, because we're not using `operate`, because we don't even `lift`.

* chore: Address comments

* chore: forgot to commit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.x Issues and PRs for version 8.x AGENDA ITEM Flagged for discussion at core team meetings
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants