mirror of
https://github.com/Hackdex-App/hackdex-website.git
synced 2026-06-20 22:29:47 -05:00
Use first curated patch as default when custom patcher list is active
This commit is contained in:
parent
5ff983f417
commit
4e86954bd2
|
|
@ -28,6 +28,7 @@ export async function getPatcherSelectablePatches(
|
|||
version: patch.version,
|
||||
created_at: patch.created_at,
|
||||
}));
|
||||
const hasSavedRows = selectablePatches.length > 0;
|
||||
if (selectablePatches.length === 0 && currentPatchId !== null) {
|
||||
const { data: currentPatch, error: currentPatchError } = await supabase
|
||||
.from("patches")
|
||||
|
|
@ -46,9 +47,11 @@ export async function getPatcherSelectablePatches(
|
|||
selectablePatches = [currentPatch];
|
||||
}
|
||||
}
|
||||
const defaultPatchId = (currentPatchId !== null && selectablePatches.some((patch) => patch.id === currentPatchId))
|
||||
? currentPatchId
|
||||
: selectablePatches[0]?.id ?? null;
|
||||
const defaultPatchId = hasSavedRows
|
||||
? selectablePatches[0]?.id ?? null
|
||||
: (currentPatchId !== null && selectablePatches.some((patch) => patch.id === currentPatchId))
|
||||
? currentPatchId
|
||||
: selectablePatches[0]?.id ?? null;
|
||||
|
||||
return {
|
||||
savedPatchIds,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user