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

docs(ivy): add feature principle doc #21565

Closed
wants to merge 1 commit into from
Closed

Conversation

mhevery
Copy link
Contributor

@mhevery mhevery commented Jan 16, 2018

No description provided.

@mhevery mhevery added the target: major This PR is targeted for the next major release label Jan 16, 2018
function queryContainerRefFeature() {...}
function queryTemplateRefFeature() {...}

query(predicate, descend, querElemntRefFeture) {...}
Copy link
Contributor

Choose a reason for hiding this comment

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

topys in queryElementRefFeature

Copy link
Contributor

Choose a reason for hiding this comment

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

typos*

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

nodeInjector: LInjector, node: LNode, read: QueryReadType | Type<any>): any {
if (read === QueryReadType.ElementRef) {
return getOrCreateElementRef(nodeInjector);
} else if (read === QueryReadType.ViewContainerRef) {
Copy link
Contributor

@vicb vicb Jan 16, 2018

Choose a reason for hiding this comment

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

nit: could you remove elses after returns (everywhere in this PR)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is cut and paste from actual code, but I will remove it.

```
function readFromNodeInjector(
nodeInjector: LInjector, node: LNode, read: QueryReadType | Type<any>): any {
if (isFeature(read) {
Copy link
Contributor

Choose a reason for hiding this comment

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

missing closing )

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed


```
function readFromNodeInjector(
nodeInjector: LInjector, node: LNode, read: QueryReadType | Type<any>): any {
Copy link
Contributor

Choose a reason for hiding this comment

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

read should be a fn ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed


The issue is that once the `query` instruction is pulled in it will pull in `ElementRef`, `ContainerRef`, and `TemplateRef` regardless if the `query` instruction queries for them.

A better way to do this is to encapsulate the work into a object or function which than will be passed into the `query` instead of the enumeration.

Choose a reason for hiding this comment

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

a object -> an object
than will -> will then

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

}
```

This approach allots us to preserve the tree-shaking. In essence the if statement has moved from runtime (non-tree-shakable) to compile time (tree-shakable) position.
Copy link
Contributor

Choose a reason for hiding this comment

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

allots -> allows

Copy link
Contributor

@vicb vicb left a comment

Choose a reason for hiding this comment

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

see inline comments

@vicb vicb added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews area: core Issues related to the framework runtime labels Jan 16, 2018
@mhevery mhevery removed the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Jan 16, 2018

```
function readFromNodeInjector(
nodeInjector: LInjector, node: LNode, readFn: QueryReadType | Type<any>): any {
Copy link
Contributor

Choose a reason for hiding this comment

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

Change the type in readFn: QueryReadType | Type<any> to (Injector) => any ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor

@vicb vicb left a comment

Choose a reason for hiding this comment

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

one last comment before LGTM

@vicb vicb added the action: merge The PR is ready for merge by the caretaker label Jan 16, 2018
@chuckjaz chuckjaz closed this in 1ccc324 Jan 18, 2018
@mhevery mhevery deleted the features branch February 14, 2018 23:01
jbogarthyde pushed a commit to jbogarthyde/angular that referenced this pull request Feb 23, 2018
leo6104 pushed a commit to leo6104/angular that referenced this pull request Mar 25, 2018
@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 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker area: core Issues related to the framework runtime cla: yes target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants