You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: utilities/warning/url-exists.js
+35-24Lines changed: 35 additions & 24 deletions
Original file line number
Diff line number
Diff line change
@@ -13,32 +13,43 @@ if (process.env.NODE_ENV !== 'production') {
13
13
consthasWarned={};
14
14
lethasExecuted;
15
15
16
-
// Using XMLHttpRequest can cause problems in non-browser environments. This should be completely removed in production environment and should not execute in a testing environment.
`The icon asset was not found at ${url}. Make sure the path to the icon asset is correct. You can set the icon path by importing the IconSettings component, \`<IconSettings iconPath=[/assets/icons]>\` from \`components/iconSettings\`, and wrap that component around your entire app or around individual components using icons. If you are using the \`<Icon>\` component, you can also pass the url to \`this.props.path\`.${additionalComment}`
`The icon asset was not found at ${url}. Make sure the path to the icon asset is correct. You can set the icon path by importing the IconSettings component, \`<IconSettings iconPath=[/assets/icons]>\` from \`components/iconSettings\`, and wrap that component around your entire app or around individual components using icons. If you are using the \`<Icon>\` component, you can also pass the url to \`this.props.path\`.${additionalComment}`
24
+
);
25
+
/* eslint-enable max-len */
26
+
hasWarned[`${control}-path`]=!!url;
40
27
}
41
28
};
29
+
30
+
constshouldWarn=(control)=>
31
+
!hasExecuted&&
32
+
!hasWarned[`${control}-path`]&&
33
+
typeofwindow!=='undefined'&&
34
+
process.env.NODE_ENV!=='test';
35
+
36
+
if(typeoffetch==='function'){
37
+
urlExists=function(control,url,comment){
38
+
if(shouldWarn(control)){
39
+
fetch(url).then(warn(control,url,comment));
40
+
}
41
+
};
42
+
}else{
43
+
// Using XMLHttpRequest can cause problems in non-browser environments. This should be completely removed in production environment and should not execute in a testing environment.
0 commit comments