chore: fixed suspense the right way

This commit is contained in:
Aron Malcher 2024-03-30 22:20:18 +01:00
parent 6fb563502a
commit d575910662
Signed by: aronmal
GPG key ID: 816B7707426FC612

View file

@ -148,7 +148,7 @@ const saveConfig = async (
return { success: true }; return { success: true };
}; };
function MyConfig() { function config() {
const params = useParams(); const params = useParams();
const navigator = useNavigate(); const navigator = useNavigate();
const location = useLocation(); const location = useLocation();
@ -201,7 +201,7 @@ function MyConfig() {
}); });
const updateValues = createMemo(() => { const updateValues = createMemo(() => {
const guild = payload()?.guild; const guild = !payload.loading && payload()?.guild;
if (!guild) return {}; if (!guild) return {};
const data = config.features.timePlanning; const data = config.features.timePlanning;
const tpInterval = combineInterval( const tpInterval = combineInterval(
@ -285,6 +285,7 @@ function MyConfig() {
}); });
return ( return (
<Layout site="config">
<div class="group"> <div class="group">
<h3>Configure li&apos;l Judd in</h3> <h3>Configure li&apos;l Judd in</h3>
<div> <div>
@ -351,7 +352,9 @@ function MyConfig() {
<p>Time Planning </p> <p>Time Planning </p>
<FontAwesomeIcon <FontAwesomeIcon
icon={ icon={
config.features.timePlanning.enabled ? faToggleOn : faToggleOff config.features.timePlanning.enabled
? faToggleOn
: faToggleOff
} }
size="xl" size="xl"
/> />
@ -363,7 +366,12 @@ function MyConfig() {
ref={(e) => setTpEnabledRef(e)} ref={(e) => setTpEnabledRef(e)}
checked={!!payload()?.guild.tpChannelId} checked={!!payload()?.guild.tpChannelId}
onInput={(e) => onInput={(e) =>
setConfig("features", "timePlanning", "enabled", e.target.checked) setConfig(
"features",
"timePlanning",
"enabled",
e.target.checked,
)
} }
/> />
<div <div
@ -451,7 +459,9 @@ function MyConfig() {
} }
> >
<Index each={Array.from(Array(24)).map((_e, i) => i)}> <Index each={Array.from(Array(24)).map((_e, i) => i)}>
{(id) => <option value={String(id())}>{String(id())}</option>} {(id) => (
<option value={String(id())}>{String(id())}</option>
)}
</Index> </Index>
</select> </select>
: :
@ -526,13 +536,6 @@ function MyConfig() {
</section> </section>
</div> </div>
</div> </div>
);
}
function config() {
return (
<Layout site="config">
<MyConfig />
</Layout> </Layout>
); );
} }