mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-29 10:42:44 +00:00
fix: optimize template hover state with v-memo and release DOM refs on unmount
This commit is contained in:
@@ -141,6 +141,7 @@
|
|||||||
v-for="template in displayTemplates"
|
v-for="template in displayTemplates"
|
||||||
:key="template.name"
|
:key="template.name"
|
||||||
ref="cardRefs"
|
ref="cardRefs"
|
||||||
|
v-memo="[template.name, hoveredTemplate === template.name]"
|
||||||
ratio="none"
|
ratio="none"
|
||||||
:max-width="300"
|
:max-width="300"
|
||||||
:min-width="200"
|
:min-width="200"
|
||||||
@@ -355,7 +356,7 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import ProgressSpinner from 'primevue/progressspinner'
|
import ProgressSpinner from 'primevue/progressspinner'
|
||||||
import { computed, onMounted, provide, ref, watch } from 'vue'
|
import { computed, onBeforeUnmount, onMounted, provide, ref, watch } from 'vue'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
|
|
||||||
import IconTextButton from '@/components/button/IconTextButton.vue'
|
import IconTextButton from '@/components/button/IconTextButton.vue'
|
||||||
@@ -668,6 +669,9 @@ onMounted(async () => {
|
|||||||
await workflowTemplatesStore.loadWorkflowTemplates()
|
await workflowTemplatesStore.loadWorkflowTemplates()
|
||||||
isLoading.value = false
|
isLoading.value = false
|
||||||
})
|
})
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
cardRefs.value = [] // Release DOM refs
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
Reference in New Issue
Block a user