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

refactor(core): refactor WrappedValue #20997

Closed
wants to merge 1 commit into from
Closed

Conversation

vicb
Copy link
Contributor

@vicb vicb commented Dec 14, 2017

  • Improve WrappedValue by adding unwrap symetrical to wrap.
  • remove dead code - ValueUnwrapper

The property wrapped is an implementation details and should never be accessed directly - use unwrap(wrappedValue). Will change to protected in Angular 7.

@mary-poppins
Copy link

You can preview af5ad97 at https://pr20997-af5ad97.ngbuilds.io/.

@mary-poppins
Copy link

You can preview 8728965 at https://pr20997-8728965.ngbuilds.io/.

@vicb vicb added area: core Issues related to the framework runtime action: review The PR is still awaiting reviews from at least one requested reviewer refactoring Issue that involves refactoring or code-cleanup target: patch This PR is targeted for the next patch release labels Dec 14, 2017

reset() { this.hasWrappedValue = false; }
static isWrapped(value: any): boolean { return value instanceof WrappedValue; }
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider changing the return type to value is WrappedValue and then changing unwrap to us it.

@mary-poppins
Copy link

You can preview 33dc163 at https://pr20997-33dc163.ngbuilds.io/.

@mary-poppins
Copy link

You can preview b508bb4 at https://pr20997-b508bb4.ngbuilds.io/.

@vicb vicb 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 Dec 14, 2017
@vicb
Copy link
Contributor Author

vicb commented Dec 14, 2017

status: await approveApiChange(); merge();

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.

otherwise lgtm

}
return value;
}
static unwrap(value: any): any { return WrappedValue.isWrapped(value) ? value.wrapped : value; }
Copy link
Contributor

Choose a reason for hiding this comment

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

please add docs

@IgorMinar IgorMinar added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews and removed action: merge The PR is ready for merge by the caretaker labels Dec 14, 2017
@IgorMinar
Copy link
Contributor

also please add better commit message description to explain the motivation behind this change.

@mary-poppins
Copy link

You can preview c662dca at https://pr20997-c662dca.ngbuilds.io/.

@mary-poppins
Copy link

You can preview fb3cae2 at https://pr20997-fb3cae2.ngbuilds.io/.

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.

Small tweaks requested. Otherwise lgtm.


reset() { this.hasWrappedValue = false; }
/** Return whether `value` is wrapped */
Copy link
Contributor

Choose a reason for hiding this comment

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

Returns true if value is wrapped.

}
return value;
}
/** Return the underlying value of a wrapped value. Returns the given `value` when it is not
Copy link
Contributor

Choose a reason for hiding this comment

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

Return - > Returns

Copy link
Contributor

Choose a reason for hiding this comment

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

And can you please move the second sentence on a new line?

*/
export class ValueUnwrapper {
public hasWrappedValue = false;
/** Creates a wrapped value */
Copy link
Contributor

Choose a reason for hiding this comment

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

Period

@vicb vicb force-pushed the 1213-wrap branch 4 times, most recently from 715405f to bbf24ee Compare December 15, 2017 02:51
@mary-poppins
Copy link

You can preview 715405f at https://pr20997-715405f.ngbuilds.io/.

@mary-poppins
Copy link

You can preview bbf24ee at https://pr20997-bbf24ee.ngbuilds.io/.

@@ -44,26 +44,22 @@ export function devModeEqual(a: any, b: any): boolean {
* @stable
*/
export class WrappedValue {
constructor(public wrapped: any) {}
/** @deprecated from 6.0, use `unwrap()` instead - will switch to protected */
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be 5.2

@IgorMinar
Copy link
Contributor

@vicb you said that this commit doesn't need a better description, yet you created an awesome description for the PR. I think the same info that's in the PR description would be useful to anyone looking at the commit via git log. Can you please copy it there?

In general we should care more about the commit messages than PR descriptions because we rarely go back to look at the old PRs but we more commonly look at individual commits when doing git log or doing release review. thanks!

- Improve `WrappedValue` by adding `unwrap` symetrical to `wrap`.
- remove dead code - `ValueUnwrapper`

The property `wrapped` is an implementation details and should never be accessed
directly - use `unwrap(wrappedValue)`. Will change to protected in Angular 7.
@mary-poppins
Copy link

You can preview 4a9c06c at https://pr20997-4a9c06c.ngbuilds.io/.

@mary-poppins
Copy link

You can preview d1adacc at https://pr20997-d1adacc.ngbuilds.io/.

@vicb vicb 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 11, 2018
@IgorMinar IgorMinar added the action: merge The PR is ready for merge by the caretaker label Jan 11, 2018
alexeagle pushed a commit that referenced this pull request Jan 16, 2018
- Improve `WrappedValue` by adding `unwrap` symetrical to `wrap`.
- remove dead code - `ValueUnwrapper`

The property `wrapped` is an implementation details and should never be accessed
directly - use `unwrap(wrappedValue)`. Will change to protected in Angular 7.

PR Close #20997
@alexeagle alexeagle closed this in 3bcc0e6 Jan 16, 2018
@vicb vicb deleted the 1213-wrap branch January 29, 2018 19:25
jbogarthyde pushed a commit to jbogarthyde/angular that referenced this pull request Feb 23, 2018
- Improve `WrappedValue` by adding `unwrap` symetrical to `wrap`.
- remove dead code - `ValueUnwrapper`

The property `wrapped` is an implementation details and should never be accessed
directly - use `unwrap(wrappedValue)`. Will change to protected in Angular 7.

PR Close angular#20997
leo6104 pushed a commit to leo6104/angular that referenced this pull request Mar 25, 2018
- Improve `WrappedValue` by adding `unwrap` symetrical to `wrap`.
- remove dead code - `ValueUnwrapper`

The property `wrapped` is an implementation details and should never be accessed
directly - use `unwrap(wrappedValue)`. Will change to protected in Angular 7.

PR Close angular#20997
@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 refactoring Issue that involves refactoring or code-cleanup target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants