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

test(ivy): create todo app in ivy #22921

Closed
wants to merge 5 commits into from

Conversation

mhevery
Copy link
Contributor

@mhevery mhevery commented Mar 22, 2018

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] angular.io application / infrastructure changes
[ ] Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

[ ] Yes
[ ] No

Other information

@mhevery mhevery added action: merge The PR is ready for merge by the caretaker target: major This PR is targeted for the next major release labels Mar 22, 2018
Copy link
Contributor

@kara kara left a comment

Choose a reason for hiding this comment

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

LGTM

- `bundle.min.js`: Is what the site would serve to their users. It has gone
through rollup, build-optimizer, and uglify with tree shaking.
- `bundle.min_debug.js`: Is what the developer would like to see when debugging
the application. It has also done through full pipeline of rollup, build-optimizer,
Copy link
Contributor

Choose a reason for hiding this comment

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

done -> gone

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

@@ -370,7 +370,8 @@ export declare const HostListener: HostListenerDecorator;

/** @experimental */
export declare function inject<T>(token: Type<T> | InjectionToken<T>, notFoundValue?: undefined, flags?: InjectFlags): T;
export declare function inject<T>(token: Type<T> | InjectionToken<T>, notFoundValue: T | null, flags?: InjectFlags): T | null;
export declare function inject<T>(token: Type<T> | InjectionToken<T>, notFoundValue: T, flags?: InjectFlags): T;
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 change is needed to otherwise inject(Foo, new Foo())'s type is Foo|null which is not correct.

@mhevery mhevery added the merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note label Mar 22, 2018
@@ -762,7 +751,7 @@ export function createFactory(
unsupported('value dependencies');
}
if (dependency.isHost) {
unsupported('host dependencies');
// unsupported('host dependencies');
Copy link
Contributor

Choose a reason for hiding this comment

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

why ? add a comment ?

Copy link
Contributor Author

@mhevery mhevery Mar 22, 2018

Choose a reason for hiding this comment

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

Opps, reverted

@ocombe ocombe added target: major This PR is targeted for the next major release and removed target: major This PR is targeted for the next major release labels Mar 22, 2018
@@ -599,17 +599,6 @@ class TemplateDefinitionBuilder implements TemplateAstVisitor, LocalResolver {
this._bindingMode, directive.sourceSpan, R3.elementProperty, o.literal(nodeIndex),
o.literal(input.templateName), o.importExpr(R3.bind).callFn([convertedBinding]));
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Should those changes be part of a different commit describing the rationale for the change ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

broken to separate commits

# path, to disambiguate from other workspaces.
# Here, the rule implementation is looking in an execroot where the layout
# has an "external" directory for external dependencies.
# This should probably start with "angular/" and let the rule deal with it.
Copy link
Contributor

Choose a reason for hiding this comment

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

# TODO: Remove once #22913 lands ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#22913 is unrelated to this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Well... that comes from you: #22654 (comment)

What did you mean 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.

resolved offline

{text: 'Demonstrate Components', done: false},
{text: 'Demonstrate Structural Directives', done: true},
{text: 'Demonstrate NgModules', done: false},
{text: 'Demonstrate zoneless changed detection', done: false},
Copy link
Contributor

Choose a reason for hiding this comment

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

typo "change"

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 reason for the guard is that template executes creation and binding together
// but NgForOf expects creation and binding separate.
template: `
<div [class.done]="todo && todo.done">
Copy link
Contributor

Choose a reason for hiding this comment

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

todo?.done ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I intentionally left it in this ugly state because it is a hack which should be removed once we fix it in ivy runtime.

`
})
export class TodoComponent {
static DEFAULT_TODO: ToDo = {text: '', done: false};
Copy link
Contributor

Choose a reason for hiding this comment

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

remove ? (AppState.DEFAULT_TODO)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed


// TODO(misko): Injection is broken because the compiler generates incorrect code.
constructor(/**appState: AppState*/) {
// TODO(misko): remove once injection is working.
Copy link
Contributor

Choose a reason for hiding this comment

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

duplicate TODO ?

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

@ngbot
Copy link

ngbot bot commented Mar 22, 2018

Hi @mhevery! This PR has merge conflicts due to recent upstream merges.
Please help to unblock it by resolving these conflicts. Thanks!

Copy link
Contributor

@IgorMinar IgorMinar left a comment

Choose a reason for hiding this comment

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

lgtm for api changes

but I'm surprised to see that we now have ivy_ng_module - fragmenting the build system like this seem like a bad idea. did you consult this with @alexeagle ?

@mhevery
Copy link
Contributor Author

mhevery commented Mar 23, 2018

@IgorMinar Yes it is a bad idea. 🙂 It is internal only build rule/hack until we have proper rule https://github.com/angular/angular/blob/master/packages/compiler/design/separate_compilation.md#ng_module-output-bazel and yes this was discussed with @alexeagle @alxhub and @chuckjaz

@mhevery mhevery force-pushed the bundle_todo_example branch 4 times, most recently from 6afcc32 to 65cf7d1 Compare March 27, 2018 00:10
@ngbot
Copy link

ngbot bot commented Mar 27, 2018

Hi @mhevery! This PR has merge conflicts due to recent upstream merges.
Please help to unblock it by resolving these conflicts. Thanks!

@mhevery mhevery force-pushed the bundle_todo_example branch 2 times, most recently from 2209b3d to 4e0511c Compare March 29, 2018 21:07
@mhevery mhevery removed the merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note label Mar 29, 2018
Copy link
Contributor

@kara kara left a comment

Choose a reason for hiding this comment

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

LGTM

$r3$.ɵE(0, 'ul', null, null, $c1$);
$r3$.ɵC(2, $c2$, MyComponent_IfDirective_Template_2);
$r3$.ɵE(0, 'ul', null, $c1$);
$r3$.ɵC(2, MyComponent_IfDirective_Template_2, null, $c2$);
Copy link
Contributor

Choose a reason for hiding this comment

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

Since IfDirective is not determined at this stage any more, how could it still remains in the template function name? Same for MyComponent_ForOfDirective_Template_1 below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right it should not be in the function name. We currently are still using old backend for the compiler which still has this information. The new compiler pipeline ngtsc will not and so when we switch over we will not be able to generate the string. Since the function name is there just to aid in debugging, i am going to leave it for now since it will get fixe automatically when we switch over to ngtsc.

@@ -400,7 +400,8 @@ function resetApplicationState() {
* @param context to pass into the template.
* @param providedRendererFactory renderer factory to use
* @param host The host element node to use
* @param defs Any directive or pipe defs that should be used for matching
* @param directives Any directive defs that should be used for matching
* @param pipes Any pipe defs that should be used for matching
Copy link
Contributor

Choose a reason for hiding this comment

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

Any directive defs -> Any directive types according to the change? (Should any be combined with plural?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the word any. Yes it is deys not types. We pass types to defineComponent which in turn converts them to defs. Because going from Type to Defs is megamorphic we want to do it as early as possible and than have all of the runtime be defs only.

@ngbot
Copy link

ngbot bot commented Mar 30, 2018

Hi @mhevery! This PR has merge conflicts due to recent upstream merges.
Please help to unblock it by resolving these conflicts. Thanks!

@ngbot
Copy link

ngbot bot commented Apr 2, 2018

Hi @mhevery! This PR has merge conflicts due to recent upstream merges.
Please help to unblock it by resolving these conflicts. Thanks!

Remove `containerRefreshStart` and `containerRefreshEnd` instruction
from the output.

Generate directives as a list in `componentDef` rather than inline into
instructions. This is consistent in making selector resolution runtime
so that translation of templates can follow locality.
@alxhub alxhub closed this in e7f1af3 Apr 2, 2018
alxhub pushed a commit that referenced this pull request Apr 2, 2018
alxhub pushed a commit that referenced this pull request Apr 2, 2018
alxhub pushed a commit that referenced this pull request Apr 2, 2018
Remove `containerRefreshStart` and `containerRefreshEnd` instruction
from the output.

Generate directives as a list in `componentDef` rather than inline into
instructions. This is consistent in making selector resolution runtime
so that translation of templates can follow locality.

PR Close #22921
alxhub pushed a commit that referenced this pull request Apr 2, 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 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

8 participants