component rendered timeout

main
dev-opsss 2 years ago
parent 27e74aca53
commit 8c8aef9939

@ -400,7 +400,8 @@ const QueueCommands: React.FC<QueueCommandsProps> = ({
/> />
); );
// Use setTimeout to ensure the component has rendered // Use a small delay to ensure the component has rendered
// 50ms is generally enough for React to complete a render cycle
setTimeout(() => { setTimeout(() => {
// Extract options from the rendered select element // Extract options from the rendered select element
const selectElement = hiddenRenderContainer.querySelector('select'); const selectElement = hiddenRenderContainer.querySelector('select');
@ -420,7 +421,7 @@ const QueueCommands: React.FC<QueueCommandsProps> = ({
// Clean up // Clean up
root.unmount(); root.unmount();
document.body.removeChild(hiddenRenderContainer); document.body.removeChild(hiddenRenderContainer);
}, 0); }, 50); // Increased timeout to ensure render completes
}} }}
tabIndex={0} tabIndex={0}
onKeyDown={(e) => { onKeyDown={(e) => {
@ -442,7 +443,8 @@ const QueueCommands: React.FC<QueueCommandsProps> = ({
/> />
); );
// Use setTimeout to ensure the component has rendered // Use a small delay to ensure the component has rendered
// 50ms is generally enough for React to complete a render cycle
setTimeout(() => { setTimeout(() => {
// Extract options from the rendered select element // Extract options from the rendered select element
const selectElement = hiddenRenderContainer.querySelector('select'); const selectElement = hiddenRenderContainer.querySelector('select');
@ -471,7 +473,7 @@ const QueueCommands: React.FC<QueueCommandsProps> = ({
// Clean up // Clean up
root.unmount(); root.unmount();
document.body.removeChild(hiddenRenderContainer); document.body.removeChild(hiddenRenderContainer);
}, 0); }, 50); // Increased timeout to ensure render completes
} }
}} }}
> >

Loading…
Cancel
Save