()
| 154 | var isUpdateScheduled: boolean = false |
| 155 | // This function aggregates updates from multiple modules into a single React Refresh call. |
| 156 | function scheduleUpdate() { |
| 157 | if (isUpdateScheduled) { |
| 158 | return |
| 159 | } |
| 160 | isUpdateScheduled = true |
| 161 | |
| 162 | function canApplyUpdate(status: ModuleHotStatus) { |
| 163 | return status === 'idle' |
| 164 | } |
| 165 | |
| 166 | function applyUpdate() { |
| 167 | isUpdateScheduled = false |
| 168 | try { |
| 169 | RefreshRuntime.performReactRefresh() |
| 170 | } catch (err) { |
| 171 | console.warn( |
| 172 | 'Warning: Failed to re-render. We will retry on the next Fast Refresh event.\n' + |
| 173 | err |
| 174 | ) |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | if (canApplyUpdate(module.hot.status())) { |
| 179 | // Apply update on the next tick. |
| 180 | Promise.resolve().then(() => { |
| 181 | applyUpdate() |
| 182 | }) |
| 183 | return |
| 184 | } |
| 185 | |
| 186 | const statusHandler = (status) => { |
| 187 | if (canApplyUpdate(status)) { |
| 188 | module.hot.removeStatusHandler(statusHandler) |
| 189 | applyUpdate() |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | // Apply update once the HMR runtime's status is idle. |
| 194 | module.hot.addStatusHandler(statusHandler) |
| 195 | } |
| 196 | |
| 197 | // Needs to be compatible with IE11 |
| 198 | export default { |
nothing calls this directly
no test coverage detected