Skip to content

Commit 18db357

Browse files
Add checkbox container guard and simplify state init
Co-authored-by: jamesmontemagno <1676321+jamesmontemagno@users.noreply.github.com>
1 parent a516d6e commit 18db357

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

docs/step.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,12 +257,12 @@
257257

258258
function initializeTaskListCheckboxes(stepId) {
259259
const container = document.getElementById('markdown-content');
260+
if (!container) return;
260261
const checkboxes = container.querySelectorAll('input[type="checkbox"]');
261262
if (checkboxes.length === 0) return;
262263

263264
const allState = readCheckboxState();
264-
const stepState = Array.isArray(allState[stepId]) ? allState[stepId] : [];
265-
allState[stepId] = stepState;
265+
const stepState = Array.isArray(allState[stepId]) ? allState[stepId] : (allState[stepId] = []);
266266

267267
checkboxes.forEach((checkbox, index) => {
268268
checkbox.disabled = false;

0 commit comments

Comments
 (0)