Skip to content

Commit

Permalink
Update VersionSelector.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
nea-c committed Jan 2, 2025
1 parent 999aa8d commit 9ea2d0f
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/web/VersionSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,24 +39,24 @@ export const VersionSelector = () => {
const rc_versions = versions.filter(v => v.kind === 'release-candidate').sort(compareReleaseCandidateVersionInfo).reverse().map(v => v.raw)

// 仮置きで最新バージョンが選択されるようにする
const f = async () => {
try {
if (major_versions[0]) {
if (!targetVersion) return dispatch(updateTargetVersion({ version: versions.find(v => v.raw == major_versions[0]) }))
const sounds: Sound[] = await myAPI.get_mcSounds(targetVersion)
setSelectedVersion(targetVersion)
dispatch(updateSoundList({ sounds }))
}
}
catch (e: unknown) { alert(e) }
}
f()
// const f = async () => {
// try {
// if (major_versions[0]) {
// if (!targetVersion) return dispatch(updateTargetVersion({ version: versions.find(v => v.raw == major_versions[0]) }))
// const sounds: Sound[] = await myAPI.get_mcSounds(targetVersion)
// setSelectedVersion(targetVersion)
// dispatch(updateSoundList({ sounds }))
// }
// }
// catch (e: unknown) { alert(e) }
// }
// f()

return [
{ label: t('release_version'), items: major_versions.map(v => ({ label: v, value: v })) },
{ label: t('snapshot_version'), items: [...rc_versions, ...pre_versions, ...snapshot_versions].map(v => ({ label: v, value: v })) },
]
}, [dispatch, t, targetVersion, versions])
}, [t, versions])

const onChangeVersion = async (version: string) => {
setSelectedVersion(version)
Expand Down

0 comments on commit 9ea2d0f

Please sign in to comment.