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