-
Notifications
You must be signed in to change notification settings - Fork 12
Avoid setState when unmounted / Fix Flow issues #146
Conversation
Codecov Report
@@ Coverage Diff @@
## master #146 +/- ##
=========================================
- Coverage 49.21% 47.72% -1.5%
=========================================
Files 9 9
Lines 128 132 +4
Branches 21 23 +2
=========================================
Hits 63 63
- Misses 65 69 +4
Continue to review full report at Codecov.
|
1 similar comment
Codecov Report
@@ Coverage Diff @@
## master #146 +/- ##
=========================================
- Coverage 49.21% 47.72% -1.5%
=========================================
Files 9 9
Lines 128 132 +4
Branches 21 23 +2
=========================================
Hits 63 63
- Misses 65 69 +4
Continue to review full report at Codecov.
|
if (this.state.$fontStyles.fontFamily !== fontName) { | ||
// $FlowFixMe | ||
// $FlowFixMe (this can only be browser so will not be 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.
If you did want to get rid of this, Flow's type refinement may help here:
if(loadFont) {
loadFont(...);
}
Either seems reasonable to me though, given this is a limitation of Flow + isomorphic code.
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 don't think that would work because the function is
export default function(font: string) {
if (__BROWSER__ && document) {
// $FlowFixMe
return document.fonts && typeof document.fonts.load === 'function'
? document.fonts.load(`1em ${font}`) // native API requires size
: loadFontPolyfill(font);
}
}
i.e. the function is always there but if NODE it returns undefined
Triggered Fusion.js build verification: https://buildkite.com/uberopensource/fusion-release-verification/builds/1853 |
Fixes #142