Skip to content

Commit

Permalink
fix #703
Browse files Browse the repository at this point in the history
  • Loading branch information
huumn committed Jan 3, 2024
1 parent 717f8d1 commit 8996fd0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion api/resolvers/item.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export const muteClause = me =>

const subClause = (sub, num, table, me) => {
return sub
? `${table ? `"${table}".` : ''}"subName" = $${num}`
? `${table ? `"${table}".` : ''}"subName" = $${num}::CITEXT`

This comment has been minimized.

Copy link
@ekzyis

ekzyis Jan 3, 2024

Member

interesting

This comment has been minimized.

Copy link
@huumn

huumn Jan 4, 2024

Author Member

Prisma or postgres casts the parameter to TEXT, which probably coerces the column to TEXT for comparison, so this is fixed by explicitly casting it to CITEXT.

: me
? `NOT EXISTS (SELECT 1 FROM "MuteSub" WHERE "MuteSub"."userId" = ${me.id} AND "MuteSub"."subName" = ${table ? `"${table}".` : ''}"subName")`
: ''
Expand Down Expand Up @@ -504,6 +504,7 @@ export default {
}
break
}

return {
cursor: items.length === limit ? nextCursorEncoded(decodedCursor) : null,
items,
Expand Down
4 changes: 2 additions & 2 deletions components/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -855,11 +855,11 @@ export function Select ({ label, items, groupClassName, onChange, noForm, overri
if (item && typeof item === 'object') {
return (
<optgroup key={item.label} label={item.label}>
{item.items.map(item => <option key={item}>{item}</option>)}
{item.items.map(item => <option key={item} value={item.toLowerCase()}>{item}</option>)}
</optgroup>
)
} else {
return <option key={item}>{item}</option>
return <option key={item} value={item.toLowerCase()}>{item}</option>
}
})}
</BootstrapForm.Select>
Expand Down
7 changes: 4 additions & 3 deletions components/sub-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,17 @@ export default function SubSelect ({ prependSubs, sub, onChange, appendSubs, fil
const subs = useSubs({ prependSubs, sub, filterSubs, appendSubs })
const valueProps = props.noForm
? {
value: sub
value: sub.toLowerCase()
}
: {
overrideValue: sub
overrideValue: sub.toLowerCase()
}

return (
<Select
onChange={onChange || ((_, e) => {
const sub = ['home', 'pick territory'].includes(e.target.value) ? undefined : e.target.value
const target = e.target.selectedOptions[0].text
const sub = ['home', 'pick territory'].includes(target) ? undefined : target
if (sub === 'create') {
router.push('/territory')
return
Expand Down

0 comments on commit 8996fd0

Please sign in to comment.