domql
domql copied to clipboard
Element not rendered (attached to document and ready to use) when `on.render` called
export const VirtuaList = {
extend: Flex,
props: {},
intersectionObserver: {
props: {
height: 'D2',
width: '100%',
backgroundColor: 'darkGray',
},
on: {
init: (el, props) => {
setTimeout(() => {
console.log(
'Found element ',
document.querySelector(`[key*=${el.key}]`)
);
}, 0);
},
render: (el, props) => {
// This can't find the element
console.log('render element', document.querySelector(`[key*=${el.key}]`))
// But this can:
setTimeout(() => {
console.log(
'render element ',
document.querySelector(`[key*=${el.key}]`)
);
}, 0);
},
}
},
list: {},
};
In the first console.log, the element should be found, but it's not.