-
-
Notifications
You must be signed in to change notification settings - Fork 388
Checkboxs on the frontend do not work on Chrome when the UI language is not English #562
Description
Expected Behavior
When toggling checkboxes on the frontend page, the corresponding settings should be updated accordingly.
Actual Behavior
The local storage is never updated with the new value.
Steps to Reproduce
- open the frontend; navigate to
Generatetab page. - toggle the checkbox at the top-right popup of the page, such as
Auto Clear Batch. - check the local storage by running
localStorage.getItem('autoClearBatch'), which always returns the same value.
Debug Logs
N/A; it is a frontend bug.
Other
I believe this stems from the line 51 below:
SwarmUI/src/wwwroot/js/genpage/main.js
Lines 46 to 52 in b7a287c
| /** Reference to the auto-clear-batch toggle checkbox. */ | |
| let autoClearBatchElem = getRequiredElementById('auto_clear_batch_checkbox'); | |
| autoClearBatchElem.checked = localStorage.getItem('autoClearBatch') == 'true'; | |
| /** Called when the user changes auto-clear-batch toggle to update local storage. */ | |
| function toggleAutoClearBatch() { | |
| localStorage.setItem('autoClearBatch', `${autoClearBatchElem.checked}`); | |
| } |
I log autoClearBatchElem.checked within toggleAutoClearBatch(), but it is always true (or false). However, if I replace the cached element with:
function toggleAutoClearBatch() {
localStorage.setItem('autoClearBatch', `${getRequiredElementById('auto_clear_batch_checkbox').checked}`);
} It works correctly. So, the issue seems to be related to the cached element autoClearBatchElem? Could it be that these elements are recreated after the page loads, but main.js does not update the variables?
Browser: Brave v1.74.48 Chromium: 132.0.6834.83 64-bit
OS: Windows 11 24H2