(force = false)
| 228 | } |
| 229 | |
| 230 | async function fetchComponent (force = false) { |
| 231 | nuxtApp[pKey] ||= {} |
| 232 | nuxtApp[pKey][uid.value] ||= _fetchComponent(force).finally(() => { |
| 233 | delete nuxtApp[pKey]![uid.value] |
| 234 | }) |
| 235 | try { |
| 236 | const res: NuxtIslandResponse = await nuxtApp[pKey][uid.value] |
| 237 | |
| 238 | ssrHTML.value = res.html.replaceAll(DATA_ISLAND_UID_RE, `data-island-uid="${uid.value}"`) |
| 239 | key.value++ |
| 240 | error.value = null |
| 241 | payloads.slots = res.slots || {} |
| 242 | payloads.components = res.components || {} |
| 243 | |
| 244 | if (selectiveClient && import.meta.client) { |
| 245 | if (canLoadClientComponent.value && res.components) { |
| 246 | await loadComponents(props.source, res.components) |
| 247 | } |
| 248 | } |
| 249 | |
| 250 | if (res?.head) { |
| 251 | if (activeHead) { |
| 252 | activeHead.patch(res.head) |
| 253 | } else { |
| 254 | activeHead = head.push(res.head) |
| 255 | } |
| 256 | } |
| 257 | |
| 258 | if (import.meta.client) { |
| 259 | // must await next tick for Teleport to work correctly with static node re-rendering |
| 260 | nextTick(() => { |
| 261 | canTeleport = true |
| 262 | teleportKey.value++ |
| 263 | }) |
| 264 | } |
| 265 | } catch (e) { |
| 266 | error.value = e |
| 267 | emit('error', e) |
| 268 | } |
| 269 | } |
| 270 | |
| 271 | expose({ |
| 272 | refresh: () => fetchComponent(true), |
no test coverage detected
searching dependent graphs…