fix undefined sub on post pre-form

This commit is contained in:
keyan 2023-07-25 15:41:46 -05:00
parent 4c1ef62386
commit 19835aef5f
1 changed files with 10 additions and 3 deletions

View File

@ -30,8 +30,16 @@ export default function SubSelect ({ label, sub, setSub, item, ...props }) {
</Info>
)
sub ||= router.query.sub
const extraProps = props.noForm ? { value: sub } : { overrideValue: sub }
sub ||= router.query.sub || 'pick sub'
const extraProps = props.noForm
? {
value: sub,
items: ['pick sub', ...SUBS]
}
: {
overrideValue: sub,
items: item ? SUBS_NO_JOBS : ['pick sub', ...SUBS_NO_JOBS]
}
return (
<Select
@ -49,7 +57,6 @@ export default function SubSelect ({ label, sub, setSub, item, ...props }) {
name='sub'
size='sm'
{...extraProps}
items={props.noForm ? ['pick sub', ...SUBS] : item ? SUBS_NO_JOBS : ['pick sub', ...SUBS_NO_JOBS]}
label={label &&
<>
{label}