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

fix(core): correctly handle lack of fallback values #949

Merged
merged 3 commits into from
Dec 27, 2018

Conversation

CaerusKaru
Copy link
Member

Fixes #947

protected updateWithValue(value: any) {
const styles = this.buildStyleMap(value);
this.ngStyleInstance.ngStyle = {...this.fallbackStyles, ...styles};
this.ngStyleInstance.ngDoCheck();
}

/** Remove generated styles */
protected clearStyles() {
this.ngStyleInstance.ngStyle = this.fallbackStyles;

Choose a reason for hiding this comment

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

I think this will fix a bug we saw with ngStyle not updating on window resize that I hadn't gotten a chance to create a report for :)

@@ -108,7 +108,9 @@ export abstract class BaseDirective2 implements OnChanges, OnDestroy {
/** Force trigger style updates on DOM element */
protected triggerUpdate() {
const val = this.marshal.getValue(this.nativeElement, this.DIRECTIVE_KEY);
this.marshal.updateElement(this.nativeElement, this.DIRECTIVE_KEY, val);
if (val !== undefined) {
this.marshal.updateElement(this.nativeElement, this.DIRECTIVE_KEY, val);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should move the checking val !== undefined inside the updateElement() method.

@@ -286,7 +288,8 @@ export class MediaMarshaller {
}
}
}
return bpMap.get('');
const lastHope = bpMap.get('');
return (key === undefined || lastHope && lastHope.has(key)) ? lastHope : undefined;
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this doing.. (in English).

Copy link
Member Author

Choose a reason for hiding this comment

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

In English, it's saying "Ok, I've exhausted all of the registered breakpoints. Now, I need to check the default breakpoint ValueMap (which is the unsung hero in the breakpoints array, ie it doesn't exist in the array). If I can't find a value in that ValueMap, there is no value, and I should return undefined. Or, no one specified a key to check for, and I should just return the whole map."

@CaerusKaru CaerusKaru merged commit 01c4148 into master Dec 27, 2018
@CaerusKaru CaerusKaru deleted the adam/fix-issue-947 branch December 27, 2018 04:27
@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 6, 2019
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Changes not applied on window resize
4 participants