Skip to content

Commit 27e74ac

Browse files
committed
Understandable Variable
1 parent 493d448 commit 27e74ac

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/components/Queue/QueueCommands.tsx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -386,13 +386,13 @@ const QueueCommands: React.FC<QueueCommandsProps> = ({
386386
className="flex items-center justify-between cursor-pointer hover:bg-white/10 rounded px-2 py-1 transition-colors"
387387
onClick={() => {
388388
// Create a hidden instance of LanguageSelector to extract languages
389-
const tempDiv = document.createElement('div');
390-
tempDiv.style.position = 'absolute';
391-
tempDiv.style.left = '-9999px';
392-
document.body.appendChild(tempDiv);
389+
const hiddenRenderContainer = document.createElement('div');
390+
hiddenRenderContainer.style.position = 'absolute';
391+
hiddenRenderContainer.style.left = '-9999px';
392+
document.body.appendChild(hiddenRenderContainer);
393393

394394
// Create a root and render the LanguageSelector temporarily
395-
const root = createRoot(tempDiv);
395+
const root = createRoot(hiddenRenderContainer);
396396
root.render(
397397
<LanguageSelector
398398
currentLanguage={currentLanguage}
@@ -403,7 +403,7 @@ const QueueCommands: React.FC<QueueCommandsProps> = ({
403403
// Use setTimeout to ensure the component has rendered
404404
setTimeout(() => {
405405
// Extract options from the rendered select element
406-
const selectElement = tempDiv.querySelector('select');
406+
const selectElement = hiddenRenderContainer.querySelector('select');
407407
if (selectElement) {
408408
const options = Array.from(selectElement.options);
409409
const values = options.map(opt => opt.value);
@@ -419,7 +419,7 @@ const QueueCommands: React.FC<QueueCommandsProps> = ({
419419

420420
// Clean up
421421
root.unmount();
422-
document.body.removeChild(tempDiv);
422+
document.body.removeChild(hiddenRenderContainer);
423423
}, 0);
424424
}}
425425
tabIndex={0}
@@ -428,13 +428,13 @@ const QueueCommands: React.FC<QueueCommandsProps> = ({
428428
e.key === 'ArrowLeft' || e.key === 'ArrowRight') {
429429

430430
// Create a hidden instance of LanguageSelector to extract languages
431-
const tempDiv = document.createElement('div');
432-
tempDiv.style.position = 'absolute';
433-
tempDiv.style.left = '-9999px';
434-
document.body.appendChild(tempDiv);
431+
const hiddenRenderContainer = document.createElement('div');
432+
hiddenRenderContainer.style.position = 'absolute';
433+
hiddenRenderContainer.style.left = '-9999px';
434+
document.body.appendChild(hiddenRenderContainer);
435435

436436
// Create a root and render the LanguageSelector temporarily
437-
const root = createRoot(tempDiv);
437+
const root = createRoot(hiddenRenderContainer);
438438
root.render(
439439
<LanguageSelector
440440
currentLanguage={currentLanguage}
@@ -445,7 +445,7 @@ const QueueCommands: React.FC<QueueCommandsProps> = ({
445445
// Use setTimeout to ensure the component has rendered
446446
setTimeout(() => {
447447
// Extract options from the rendered select element
448-
const selectElement = tempDiv.querySelector('select');
448+
const selectElement = hiddenRenderContainer.querySelector('select');
449449
if (selectElement) {
450450
const options = Array.from(selectElement.options);
451451
const values = options.map(opt => opt.value);
@@ -470,7 +470,7 @@ const QueueCommands: React.FC<QueueCommandsProps> = ({
470470

471471
// Clean up
472472
root.unmount();
473-
document.body.removeChild(tempDiv);
473+
document.body.removeChild(hiddenRenderContainer);
474474
}, 0);
475475
}
476476
}}

0 commit comments

Comments
 (0)