fix: ensure useFillHeight recalculates when element appears (v-if)
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { onMounted, onUnmounted, ref, nextTick } from 'vue'
|
import { onMounted, onUnmounted, ref, nextTick, watch } from 'vue'
|
||||||
import { UI_CONFIG } from '../config/ui'
|
import { UI_CONFIG } from '../config/ui'
|
||||||
|
|
||||||
export function useFillHeight(elementRef, extraMargin = 0) {
|
export function useFillHeight(elementRef, extraMargin = 0) {
|
||||||
@@ -29,6 +29,13 @@ export function useFillHeight(elementRef, extraMargin = 0) {
|
|||||||
|
|
||||||
// Also update after a short delay to ensure layout is settled (e.g. sidebar transitions)
|
// Also update after a short delay to ensure layout is settled (e.g. sidebar transitions)
|
||||||
setTimeout(updateHeight, 300)
|
setTimeout(updateHeight, 300)
|
||||||
|
|
||||||
|
// Watch for element appearing (v-if) or changing
|
||||||
|
watch(elementRef, () => {
|
||||||
|
nextTick(updateHeight)
|
||||||
|
// Additional update for layout stability
|
||||||
|
setTimeout(updateHeight, 100)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user