MCPcopy
hub / github.com/vuejs/core / rerender

Function rerender

packages/runtime-core/src/hmr.ts:89–113  ·  view source on GitHub ↗
(id: string, newRender?: Function)

Source from the content-addressed store, hash-verified

87}
88
89function 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
115function reload(id: string, newComp: HMRComponent): void {
116 const record = map.get(id)

Callers 2

hmr.spec.tsFile · 0.85
Teleport.spec.tsFile · 0.85

Calls 3

normalizeClassComponentFunction · 0.85
forEachMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected