Skip to content

Commit 2f93c6c

Browse files
committed
fix(stage-ui): full load on HMR dispose to avoid corrupted models
1 parent cd7afb6 commit 2f93c6c

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

packages/stage-ui/src/components/scenes/live2d/Canvas.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ defineExpose({
9191
captureFrame,
9292
canvasElement,
9393
})
94+
95+
import.meta.hot?.dispose(() => {
96+
console.warn('[Dev] Reload on HMR dispose is active for this component. Performing a full reload.')
97+
window.location.reload()
98+
})
9499
</script>
95100

96101
<template>

packages/stage-ui/src/components/scenes/live2d/Model.vue

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -402,14 +402,6 @@ onMounted(async () => {
402402
updateDropShadowFilter()
403403
})
404404
405-
function componentCleanUp() {
406-
cancelAnimationFrame(dropShadowAnimationId.value)
407-
model.value && pixiApp.value?.stage.removeChild(model.value)
408-
}
409-
onUnmounted(() => {
410-
componentCleanUp()
411-
})
412-
413405
function listMotionGroups() {
414406
return availableMotions.value
415407
}
@@ -419,12 +411,10 @@ defineExpose({
419411
listMotionGroups,
420412
})
421413
422-
if (import.meta.hot) {
423-
// Ensure cleanup on HMR
424-
import.meta.hot.dispose(() => {
425-
componentCleanUp()
426-
})
427-
}
414+
import.meta.hot?.dispose(() => {
415+
console.warn('[Dev] Reload on HMR dispose is active for this component. Performing a full reload.')
416+
window.location.reload()
417+
})
428418
</script>
429419

430420
<template>

0 commit comments

Comments
 (0)