Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "office-ui-fabric-react",
"comment": "withResponsiveMode: Adding error handling around the case where window.innerWidth throws an exception.",
"type": "patch"
}
],
"packageName": "office-ui-fabric-react",
"email": "admitt@microsoft.com"
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,12 @@ export function withResponsiveMode<P extends { responsiveMode?: ResponsiveMode }
let win = getWindow();

if (typeof win !== 'undefined') {
while (win.innerWidth > RESPONSIVE_MAX_CONSTRAINT[responsiveMode]) {
responsiveMode++;
try {
while (win.innerWidth > RESPONSIVE_MAX_CONSTRAINT[responsiveMode]) {
responsiveMode++;
}
} catch (e) {
responsiveMode = undefined;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It seems like you should fall back to _defaultMode. Returning undefined is unexpected, given it doesn't map to any enum value.

}
} else {
if (_defaultMode !== undefined) {
Expand Down