fix(panel): guild settings not pre-filling from database
Some checks failed
Deploy to Production / test (push) Failing after 33s
Some checks failed
Deploy to Production / test (push) Failing after 33s
Guild draft was initialized with defaults before the API response arrived, then never updated because the !guildDraft guard prevented overwriting. Gate initialization on !loading so saved values are used. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -20,7 +20,6 @@ import {
|
|||||||
useSettings,
|
useSettings,
|
||||||
type GameSettings,
|
type GameSettings,
|
||||||
type GuildSettings,
|
type GuildSettings,
|
||||||
type SettingsMeta,
|
|
||||||
} from "../lib/useSettings";
|
} from "../lib/useSettings";
|
||||||
import {
|
import {
|
||||||
GuildSection,
|
GuildSection,
|
||||||
@@ -107,14 +106,14 @@ export default function Settings() {
|
|||||||
}, [settings, gameDraft]);
|
}, [settings, gameDraft]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!guildDraft) {
|
if (!guildDraft && !loading) {
|
||||||
setGuildDraft(
|
setGuildDraft(
|
||||||
guildSettings
|
guildSettings
|
||||||
? structuredClone(guildSettings)
|
? structuredClone(guildSettings)
|
||||||
: { ...defaultGuildSettings, guildId: meta?.guildId ?? "" }
|
: { ...defaultGuildSettings, guildId: meta?.guildId ?? "" }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}, [guildSettings, guildDraft, meta?.guildId]);
|
}, [guildSettings, guildDraft, meta?.guildId, loading]);
|
||||||
|
|
||||||
const isGuildTab = activeSection === "guild";
|
const isGuildTab = activeSection === "guild";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user