Skip to content

Conversation

CaerusKaru
Copy link
Member

@CaerusKaru CaerusKaru commented May 5, 2020

Add a schematic to update users to the new v11 initialNavigation
options for RouterModule. This replaces the deprecated/removed
true, false, legacy_disabled, and legacy_enabled options
with the newer enabledBlocking and enabledNonBlocking options.

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

Follow-up to #33128

@pullapprove pullapprove bot requested review from josephperrott and kara May 5, 2020 00:44
@mhevery mhevery added the area: core Issues related to the framework runtime label May 11, 2020
@ngbot ngbot bot added this to the needsTriage milestone May 11, 2020
@pullapprove pullapprove bot requested a review from devversion July 21, 2020 18:45
@CaerusKaru CaerusKaru requested review from atscott and removed request for kara July 21, 2020 18:46
@CaerusKaru CaerusKaru added action: review The PR is still awaiting reviews from at least one requested reviewer target: major This PR is targeted for the next major release labels Jul 21, 2020
@CaerusKaru CaerusKaru force-pushed the adam/scm branch 2 times, most recently from 6f23cbc to b3cb8ef Compare July 21, 2020 18:57
those options by hand. Otherwise, the compiler will error if the types are sufficiently enforced.

The basic migration strategy is as follows:
* `legacy_disabled` || `false` => `disabled`
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure if we can have this change as part of the migration in 10.1 since legacy_disabled and false work slightly differently than disabled. We might only be able to make migrations that are exactly 1 to 1 now and then update this in v11.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I'd agree with this.

Copy link
Contributor

Choose a reason for hiding this comment

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

@CaerusKaru now that master is targeting v11, I think we can submit this change. Can you do a quick pass over this migration and the follow-up PR to remove the old options?

Copy link
Member

@devversion devversion left a comment

Choose a reason for hiding this comment

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

LGTM. A few minor nits. I'm glad we decided on the more straightforward non-static-interpreter approach as that seems to capture the most common cases quite reliably.

those options by hand. Otherwise, the compiler will error if the types are sufficiently enforced.

The basic migration strategy is as follows:
* `legacy_disabled` || `false` => `disabled`
Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I'd agree with this.


await runMigration();
expect(tree.readContent('/index.ts')).toContain(`enabledNonBlocking`);
expect(tree.readContent('/index.ts')).toContain(`disabled`);
Copy link
Member

Choose a reason for hiding this comment

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

Nit: should these assertions (and in other tests) be a little more precise? Right now options could theoretically swapped in wrong order. Might just make this a small regex checking for surrounding context.

@devversion devversion added the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Jul 29, 2020
@pullapprove pullapprove bot requested a review from alxhub September 28, 2020 20:30
@CaerusKaru CaerusKaru 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 Oct 10, 2020
@CaerusKaru CaerusKaru force-pushed the adam/scm branch 2 times, most recently from dd42af1 to e12d456 Compare October 10, 2020 03:53
Copy link
Contributor

@atscott atscott left a comment

Choose a reason for hiding this comment

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

LGTM with a couple small comments

@CaerusKaru CaerusKaru force-pushed the adam/scm branch 4 times, most recently from 68bffa3 to cfd6380 Compare October 10, 2020 05:19
Copy link
Member

@gkalpak gkalpak left a comment

Choose a reason for hiding this comment

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

Reviewed-for: dev-infra

@@ -0,0 +1,211 @@
/**
Copy link
Member

Choose a reason for hiding this comment

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

Nit: The _rule part in the file name feels confusing. I think it would be more consistent without the _rule part as well (although some other spec files have it, most don't).

@@ -20,7 +20,7 @@ export interface AnalysisFailure {
message: string;
}

const TODO_COMMENT = 'TODO: The following node requires a generic type for `ModuleWithProviders';
const TODO_COMMENT = 'TODO: The following node requires a generic type for `ModuleWithProviders`';
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Since this change is unrelated, consider moving it to a separate commit.

return failures;

/** Gets the update recorder for the specified source file. */
function getUpdateRecorder(sourceFile: ts.SourceFile): TslintUpdateRecorder {
Copy link
Member

Choose a reason for hiding this comment

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

Consider moving it into a private method or outside of applyWithProgram so the function doesn't get re-declared on each invocation.

@atscott atscott force-pushed the adam/scm branch 3 times, most recently from 44c03cd to d384e65 Compare October 13, 2020 20:51
@atscott atscott added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Oct 14, 2020
CaerusKaru and others added 2 commits October 14, 2020 11:21
Add a schematic to update users to the new v11 `initialNavigation`
options for `RouterModule`. This replaces the deprecated/removed
`true`, `false`, `legacy_disabled`, and `legacy_enabled` options
with the newer `enabledBlocking` and `enabledNonBlocking` options.
@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 Nov 14, 2020
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.

7 participants