@@ -150,6 +150,7 @@ import {
150
150
QSlotParent ,
151
151
QStyle ,
152
152
QStylesAllSelector ,
153
+ qwikInspectorAttr ,
153
154
} from '../shared/utils/markers' ;
154
155
import { isHtmlElement } from '../shared/utils/types' ;
155
156
import { VNodeDataChar } from '../shared/vnode-data-types' ;
@@ -1829,9 +1830,49 @@ function materializeFromVNodeData(
1829
1830
if ( isNumber ( peek ( ) ) ) {
1830
1831
// Element counts get encoded as numbers.
1831
1832
while ( ! isElement ( child ) ) {
1833
+ const previousChild = child ;
1832
1834
child = fastNextSibling ( child ) ;
1833
1835
if ( ! child ) {
1834
- throw qError ( QError . materializeVNodeDataError , [ vData , peek ( ) , nextToConsumeIdx ] ) ;
1836
+ let childDescription : string | null = null ;
1837
+ let childDescriptionFile : string | null = null ;
1838
+ if ( isDev ) {
1839
+ const getChildDescription = ( ) => {
1840
+ if ( previousChild && isElement ( previousChild ) ) {
1841
+ return previousChild . outerHTML ;
1842
+ } else if ( previousChild && isText ( previousChild ) ) {
1843
+ return previousChild . nodeValue ;
1844
+ } else {
1845
+ return previousChild ?. nodeName || null ;
1846
+ }
1847
+ } ;
1848
+
1849
+ const getChildDescriptionFile = ( ) => {
1850
+ let previousChildWithFileLocation = previousChild ;
1851
+ while ( ! childDescriptionFile && previousChildWithFileLocation ) {
1852
+ if (
1853
+ isElement ( previousChildWithFileLocation ) &&
1854
+ previousChildWithFileLocation . hasAttribute ( qwikInspectorAttr )
1855
+ ) {
1856
+ return previousChildWithFileLocation . getAttribute ( qwikInspectorAttr ) ;
1857
+ }
1858
+ previousChildWithFileLocation =
1859
+ previousChildWithFileLocation . parentNode as Node | null ;
1860
+ }
1861
+ return null ;
1862
+ } ;
1863
+
1864
+ childDescription = getChildDescription ( ) ;
1865
+ childDescriptionFile = getChildDescriptionFile ( ) ;
1866
+ } else {
1867
+ childDescription = previousChild ?. nodeName || null ;
1868
+ }
1869
+ throw qError ( QError . materializeVNodeDataError , [
1870
+ childDescription ,
1871
+ childDescriptionFile ,
1872
+ vData ,
1873
+ peek ( ) ,
1874
+ nextToConsumeIdx ,
1875
+ ] ) ;
1835
1876
}
1836
1877
}
1837
1878
// We pretend that style element's don't exist as they can get moved out.
0 commit comments