mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-09-10 13:15:47 -05:00
Fix bug w/ WeaponCombobox not showing initial val
This commit is contained in:
@@ -208,7 +208,11 @@ export function WeaponCombobox({
|
||||
<Combobox
|
||||
inputName={inputName}
|
||||
options={mainWeaponIds.map(idToWeapon)}
|
||||
initialValue={initialWeaponId ? idToWeapon(initialWeaponId) : undefined}
|
||||
initialValue={
|
||||
typeof initialWeaponId === "number"
|
||||
? idToWeapon(initialWeaponId)
|
||||
: undefined
|
||||
}
|
||||
placeholder={t(`${mainWeaponIds[0]}`)}
|
||||
onChange={onChange}
|
||||
className={className}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import * as React from "react";
|
||||
import type {
|
||||
BuildAbilitiesTupleWithUnknown,
|
||||
MainWeaponId,
|
||||
import {
|
||||
type BuildAbilitiesTupleWithUnknown,
|
||||
type MainWeaponId,
|
||||
mainWeaponIds,
|
||||
} from "../in-game-lists";
|
||||
import { buildStats } from "./stats";
|
||||
|
||||
@@ -11,7 +12,9 @@ export function useAnalyzeBuild() {
|
||||
["UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN"],
|
||||
["UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN"],
|
||||
]);
|
||||
const [weaponId, setWeaponId] = React.useState<MainWeaponId>(0);
|
||||
const [weaponId, setWeaponId] = React.useState<MainWeaponId>(
|
||||
mainWeaponIds[0]
|
||||
);
|
||||
|
||||
const analyzed = React.useMemo(
|
||||
() => buildStats({ build, weaponSplId: weaponId }),
|
||||
|
||||
@@ -30,7 +30,7 @@ export default function BuildAnalyzerPage() {
|
||||
<div className="stack lg items-center">
|
||||
<div>
|
||||
<WeaponCombobox
|
||||
inputName="weapon-1"
|
||||
inputName="weapon"
|
||||
initialWeaponId={weaponId}
|
||||
onChange={(opt) =>
|
||||
opt && setWeaponId(Number(opt.value) as MainWeaponId)
|
||||
|
||||
Reference in New Issue
Block a user