(factory)
| 2 | import { showUpgradeProgress } from "./upgradeProgress"; |
| 3 | |
| 4 | export function lazyWithRetry(factory) { |
| 5 | return React.lazy(() => |
| 6 | factory().catch((error) => { |
| 7 | if ( |
| 8 | error && |
| 9 | error.message && |
| 10 | /Failed to fetch dynamically imported module/.test(error.message) |
| 11 | ) { |
| 12 | localStorage.setItem("showUpgradeProgress", "1"); |
| 13 | showUpgradeProgress(); |
| 14 | setTimeout(() => window.location.reload(), 100); |
| 15 | } |
| 16 | throw error; |
| 17 | }) |
| 18 | ); |
| 19 | } |
no test coverage detected