Skip to content

Commit

Permalink
fix(VExpandTransition): work around calling hooks out of order
Browse files Browse the repository at this point in the history
  • Loading branch information
KaelWD committed Jan 30, 2025
1 parent e85225d commit d6fdc1b
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ export default function (expandedParentClass = '', x = false) {
},

onEnter (el: HTMLExpandElement) {
const initialStyle = el._initialStyle!
const initialStyle = el._initialStyle
if (!initialStyle) return

el.style.setProperty('transition', 'none', 'important')
// Hide overflow to account for collapsed margins in the calculated height
Expand Down Expand Up @@ -77,8 +78,10 @@ export default function (expandedParentClass = '', x = false) {
}

function resetStyles (el: HTMLExpandElement) {
const size = el._initialStyle![sizeProperty]
el.style.overflow = el._initialStyle!.overflow
if (!el._initialStyle) return

const size = el._initialStyle[sizeProperty]
el.style.overflow = el._initialStyle.overflow
if (size != null) el.style[sizeProperty] = size
delete el._initialStyle
}
Expand Down

0 comments on commit d6fdc1b

Please sign in to comment.