@@ -168,12 +168,13 @@ watch(isExpanded, (isExpanding) => {
168168 })
169169
170170 requestAnimationFrame (() => {
171+ if (! collapseRef .value ) return
171172 /** If for any unknown edge case the scrollHeight === 0, abort transition and force expand */
172- if (collapseRef .value ! .scrollHeight === 0 ) return onExpanded ()
173+ if (collapseRef .value .scrollHeight === 0 ) return onExpanded ()
173174
174175 /** Set height to scrollHeight and trigger the transition. */
175176
176- transitionStartScrollHeight = collapseRef .value ! .scrollHeight
177+ transitionStartScrollHeight = collapseRef .value .scrollHeight
177178
178179 addStyles ({
179180 ... getTransitionProp (collapseRef ),
@@ -203,6 +204,7 @@ watch(isExpanded, (isExpanding) => {
203204 if (collapseRef .value .scrollHeight === 0 ) return onCollapsed ()
204205
205206 requestAnimationFrame (() => {
207+ if (! collapseRef .value ) return
206208 /** Set height to baseHeight and trigger the transition. */
207209 addStyles ({
208210 ... baseHeightStyles .value ,
@@ -228,6 +230,8 @@ watch(baseHeight, (newBaseHeight) => {
228230// Transition events
229231
230232function onTransitionEnd(e : TransitionEvent ) {
233+ if (! collapseRef .value ) return
234+
231235 if (e .target && e .target === collapseRef .value && e .propertyName === ' height' ) {
232236 /**
233237 * Reset styles to the initial style state,
0 commit comments