Skip to content

Pipeable #8976

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

Merged
merged 1 commit into from
Jan 23, 2018
Merged

Pipeable #8976

merged 1 commit into from
Jan 23, 2018

Conversation

Brocco
Copy link
Contributor

@Brocco Brocco commented Dec 22, 2017

No description provided.

@@ -1,13 +1,13 @@
import {LogEntry, Logger} from './logger';
import {ConsoleLoggerStack} from './console-logger-stack';
import {NullLogger} from './null-logger';
import {toArray} from 'rxjs/operators';
Copy link
Member

Choose a reason for hiding this comment

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

This should be an import directly from 'rxjs/operators/toArray'

Choose a reason for hiding this comment

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

no, importing from 'rxjs/operators' is fine

Copy link
Member

Choose a reason for hiding this comment

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

This is to maintain parity with angular/material2, angular/flex-layout, and angular/preboot, starting with angular/components#8160. It seems like it's an open question though on that thread, and will probably become irrelevant as RxJS 6 comes closer

Choose a reason for hiding this comment

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

Importing from operators does cause a larger bundle currently but from memory that's a bug at the moment and should be fixed. With that in mind I think the more ergonomic approach should be the desired kne

Copy link
Member

Choose a reason for hiding this comment

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

Please note also that this is a node application not a web application. Bundle size is irrelevant.

Copy link
Member

Choose a reason for hiding this comment

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

I think it's more about setting a precedent for best practices, as a lot of developers look to first-party packages like this for guidance (node app or no), especially when it comes to RxJS. Again, for this at least it seems to be a non-starter, the only reason I'm leaving this comment up is to archive the discussion.

Copy link
Contributor

Choose a reason for hiding this comment

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

Best practices for RxJS 6 is to import {toArray} from 'rxjs'. I'm personally okay with this as it's likely the whole Angular ecosystem will move towards that over the next quarter or two.

@CDDelta
Copy link

CDDelta commented Dec 26, 2017

Maybe blacklist importing the whole rxjs library by adding this to tslint.json "import-blacklist": [true, "rxjs", "rxjs/operators"]

@trotyl
Copy link
Contributor

trotyl commented Dec 27, 2017

@CDDelta Importing from rxjs/operators won't cause any bundle size problem in runtime:

image

Let alone this change is for cli tasks only.

@CDDelta
Copy link

CDDelta commented Dec 27, 2017

@trotyl I just thought it would be a good idea since that was what @CaerusKaru was pushing for, but you are right this is more of a style thing than a tree-shaking thing.

import {Observable} from 'rxjs/Observable';

import 'rxjs/add/observable/empty';
import { EmptyObservable } from 'rxjs/Observable/EmptyObservable';
Copy link
Member

Choose a reason for hiding this comment

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

Lower case 'o' in rxjs/observable/EmptyObservable.
Also rxjs v6 appears to be moving towards using creation helpers over class instantiation. So may want to go with import { empty } from 'rxjs/observable/empty';

@hansl hansl merged commit 5a736bd into angular:master Jan 23, 2018
@Brocco Brocco deleted the lettable branch April 3, 2018 13:13
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants