-
Notifications
You must be signed in to change notification settings - Fork 768
fix(core): correctly handle lack of fallback values #949
Conversation
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; |
There was a problem hiding this comment.
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 :)
83a221f
to
0808931
Compare
@@ -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); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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."
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Fixes #947