The unasked council's clearing effect watches the turn
It checked its own plain flag first and returned, so the turn was never read and never tracked; the effect ran once and slept. The turn is read first now, and the flag is reactive. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jm2auWk6RP71CjaAb4FMoG
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
e724267b0a
commit
9f98a4fc59
@@ -1397,7 +1397,7 @@
|
|||||||
* not know to ask, and a minute's silence is how they leave. */
|
* not know to ask, and a minute's silence is how they leave. */
|
||||||
let counciled = false;
|
let counciled = false;
|
||||||
/** The unasked advice is for that one turn: it leaves when the turn does. */
|
/** The unasked advice is for that one turn: it leaves when the turn does. */
|
||||||
let councilUnasked = false;
|
let councilUnasked = $state(false);
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
if (!view || !isYourTurn || prefs.coached || view.turn.round !== 1 || counciled || councilHints !== null) return;
|
if (!view || !isYourTurn || prefs.coached || view.turn.round !== 1 || counciled || councilHints !== null) return;
|
||||||
counciled = true;
|
counciled = true;
|
||||||
@@ -1405,8 +1405,12 @@
|
|||||||
void askCouncil();
|
void askCouncil();
|
||||||
});
|
});
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
if (!councilUnasked || !view) return;
|
// Read the turn before anything else: an early return that never
|
||||||
if (!isYourTurn || view.turn.round !== 1) { councilHints = null; councilUnasked = false; }
|
// touches it would leave this effect with nothing to wake it.
|
||||||
|
const stillFirstTurn = isYourTurn && view?.turn.round === 1;
|
||||||
|
if (!councilUnasked || stillFirstTurn) return;
|
||||||
|
councilHints = null;
|
||||||
|
councilUnasked = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
/** Arrow keys and WASD walk on the board, as they do in the first-person
|
/** Arrow keys and WASD walk on the board, as they do in the first-person
|
||||||
|
|||||||
Reference in New Issue
Block a user