(id: string, newRender?: Function)
| 87 | } |
| 88 | |
| 89 | function rerender(id: string, newRender?: Function): void { |
| 90 | const record = map.get(id) |
| 91 | if (!record) { |
| 92 | return |
| 93 | } |
| 94 | |
| 95 | // update initial record (for not-yet-rendered component) |
| 96 | record.initialDef.render = newRender |
| 97 | |
| 98 | // Create a snapshot which avoids the set being mutated during updates |
| 99 | ;[...record.instances].forEach(instance => { |
| 100 | if (newRender) { |
| 101 | instance.render = newRender as InternalRenderFunction |
| 102 | normalizeClassComponent(instance.type as HMRComponent).render = newRender |
| 103 | } |
| 104 | instance.renderCache = [] |
| 105 | // this flag forces child components with slot content to update |
| 106 | isHmrUpdating = true |
| 107 | // #13771 don't update if the job is already disposed |
| 108 | if (!(instance.job.flags! & SchedulerJobFlags.DISPOSED)) { |
| 109 | instance.update() |
| 110 | } |
| 111 | isHmrUpdating = false |
| 112 | }) |
| 113 | } |
| 114 | |
| 115 | function reload(id: string, newComp: HMRComponent): void { |
| 116 | const record = map.get(id) |
no test coverage detected