From ed4506dc68a547a53187e9476df8b1e659f82808 Mon Sep 17 00:00:00 2001 From: Lucas 'Paperboy' Rose-Winters Date: Fri, 17 Oct 2025 12:26:40 +1100 Subject: [PATCH] fix(dice): replace const assignments with setter function calls After modular refactor, `pendingDiceRoll` is imported as const from state module and cannot be reassigned. Replace three direct assignments with `setPendingDiceRoll()` setter function calls: - DiceModal.close() method (line 572) - Save roll button handler (line 691) - rollDice() function (line 773) Fixes "Assignment to constant variable" errors preventing dice rolls. --- index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 3d7a0e2..af7e5f3 100644 --- a/index.js +++ b/index.js @@ -569,7 +569,7 @@ class DiceModal { this.isAnimating = false; // Clear pending roll - pendingDiceRoll = null; + setPendingDiceRoll(null); }, 200); } @@ -688,7 +688,7 @@ function setupDiceRoller() { extensionSettings.lastDiceRoll = pendingDiceRoll; saveSettings(); updateDiceDisplay(); - pendingDiceRoll = null; + setPendingDiceRoll(null); } closeDicePopup(); }); @@ -770,12 +770,12 @@ async function rollDice() { const rolls = rollResult.rolls || []; // Store result temporarily (not saved until "Save Roll" is clicked) - pendingDiceRoll = { + setPendingDiceRoll({ formula: `${count}d${sides}`, total: total, rolls: rolls, timestamp: Date.now() - }; + }); // Show result diceModal.showResult(total, rolls);