File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -10,17 +10,24 @@ export const getRefs = (el: HTMLElement) => {
1010
1111 walkComponent ( el , el => {
1212 const { ref } = el . dataset
13- if ( ref ) addRef ( ref , el )
13+ if ( ! ref ) return
14+
15+ const isDeepRef = ref . includes ( '/' )
16+ if ( isDeepRef ) return
17+
18+ addRef ( ref , el )
1419 } )
1520
21+ // Deep refs can't be handled during DOM walk, since we stop at child
22+ // components.
1623 const deepRefs = el . querySelectorAll < HTMLElement > ( '[data-ref*="/"]' )
1724 deepRefs . forEach ( refEl => {
1825 const [ parent , name ] = refEl . dataset . ref ! . split ( '/' )
1926
2027 const selector = parent . match ( / ^ \( ( .* ) \) $ / ) ?. [ 1 ]
2128 const parentSelector = selector ?? `[data-simple-component='${ parent } ']`
2229
23- const parentEl = el . closest ( parentSelector )
30+ const parentEl = refEl . closest ( parentSelector )
2431 if ( parentEl === el ) addRef ( name , refEl )
2532 } )
2633
You can’t perform that action at this time.
0 commit comments