Fix: Persist Size across Collapsing Vue Nodes (#6726)

## Summary

When restoring a collapsed node, return to the uncollapsed size.

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-6726-Fix-Persist-Size-across-Collapsing-Vue-Nodes-2ae6d73d365081e28628d5640bc35ab3)
by [Unito](https://www.unito.io)
This commit is contained in:
Alexander Brown
2025-11-17 14:04:08 -08:00
committed by GitHub
parent 471ccca1dd
commit 2f81e5b30a

View File

@@ -135,9 +135,8 @@
</template>
<script setup lang="ts">
import { whenever } from '@vueuse/core'
import { storeToRefs } from 'pinia'
import { computed, inject, onErrorCaptured, onMounted, ref } from 'vue'
import { computed, inject, onErrorCaptured, onMounted, ref, watch } from 'vue'
import { useI18n } from 'vue-i18n'
import type { VueNodeData } from '@/composables/graph/useGraphNodeManager'
@@ -373,11 +372,17 @@ const handleResizePointerDown = (direction: ResizeHandleDirection) => {
}
}
whenever(isCollapsed, () => {
watch(isCollapsed, (collapsed) => {
const element = nodeContainerRef.value
if (!element) return
element.style.setProperty('--node-width', '')
element.style.setProperty('--node-height', '')
const [from, to] = collapsed ? ['', '-x'] : ['-x', '']
const currentWidth = element.style.getPropertyValue(`--node-width${from}`)
element.style.setProperty(`--node-width${to}`, currentWidth)
element.style.setProperty(`--node-width${from}`, '')
const currentHeight = element.style.getPropertyValue(`--node-height${from}`)
element.style.setProperty(`--node-height${to}`, currentHeight)
element.style.setProperty(`--node-height${from}`, '')
})
// Check if node has custom content (like image/video outputs)