ui/phase-22: skip the no-op stance click in the races table
Clicking the already-active WAR/PEACE button still appended a \`setDiplomaticStance\` whose \`relation\` matched the row's current value. The engine would accept the duplicate harmlessly, but the order tab inflates with rows that say nothing and every auto-sync re-ships the redundant payload. Compare against the overlayed stance (so a queued-but-not-applied change suppresses a re-click that matches the *intended* state, not just the server snapshot) and short-circuit when they agree. Mirrors the vote picker, which already had the same guard. vitest.config.ts: \`mergeConfig\` refuses callback-form base configs, so resolve \`vite.config.ts\`'s callback with the test context first and merge the plain object. Surfaced after the \`loadEnv\` migration switched the root config to the callback form. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -148,6 +148,15 @@ data fetching is performed here — the layout is responsible.
|
||||
|
||||
async function setStance(acceptor: string, relation: Relation): Promise<void> {
|
||||
if (draft === undefined) return;
|
||||
// No-op when the row already reflects the requested stance — the
|
||||
// engine would accept the duplicate, but queueing a wire entry
|
||||
// that re-states the current state inflates the order tab and
|
||||
// the auto-sync envelope for nothing. The current stance reads
|
||||
// off the overlay (`races[i].relation`), so a queued-but-not-
|
||||
// applied stance change correctly suppresses a duplicate click
|
||||
// that matches the *queued* intent, not just the server snapshot.
|
||||
const current = races.find((r) => r.name === acceptor)?.relation;
|
||||
if (current === relation) return;
|
||||
await draft.add({
|
||||
kind: "setDiplomaticStance",
|
||||
id: crypto.randomUUID(),
|
||||
|
||||
Reference in New Issue
Block a user