ek boost hint suggestions
This commit is contained in:
parent
09be42844e
commit
2f191e04f9
|
@ -690,7 +690,8 @@ export default {
|
|||
boost: { gte: boost },
|
||||
status: 'ACTIVE',
|
||||
deletedAt: null,
|
||||
outlawed: false
|
||||
outlawed: false,
|
||||
parentId: null
|
||||
}
|
||||
if (id) {
|
||||
where.id = { not: Number(id) }
|
||||
|
@ -698,7 +699,7 @@ export default {
|
|||
|
||||
return {
|
||||
home: await models.item.count({ where }) === 0,
|
||||
sub: await models.item.count({ where: { ...where, subName: sub } }) === 0
|
||||
sub: sub ? await models.item.count({ where: { ...where, subName: sub } }) === 0 : false
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -90,8 +90,8 @@ export function BoostItemInput ({ item, sub, act = false, ...props }) {
|
|||
const [boost, setBoost] = useState(Number(item?.boost) + (act ? BOOST_MULT : 0))
|
||||
|
||||
const [getBoostPosition, { data }] = useLazyQuery(gql`
|
||||
query BoostPosition($id: ID, $boost: Int) {
|
||||
boostPosition(sub: "${item?.subName || sub?.name}", id: $id, boost: $boost) {
|
||||
query BoostPosition($sub: String, $id: ID, $boost: Int) {
|
||||
boostPosition(sub: $sub, id: $id, boost: $boost) {
|
||||
home
|
||||
sub
|
||||
}
|
||||
|
@ -101,10 +101,10 @@ export function BoostItemInput ({ item, sub, act = false, ...props }) {
|
|||
const getPositionDebounce = useDebounceCallback((...args) => getBoostPosition(...args), 1000, [getBoostPosition])
|
||||
|
||||
useEffect(() => {
|
||||
if (boost) {
|
||||
getPositionDebounce({ variables: { boost: Number(boost), id: item?.id } })
|
||||
if (boost >= 0 && !item?.parentId) {
|
||||
getPositionDebounce({ variables: { sub: item?.subName || sub?.name, boost: Number(boost), id: item?.id } })
|
||||
}
|
||||
}, [boost, item?.id])
|
||||
}, [boost, item?.id, !item?.parentId, item?.subName || sub?.name])
|
||||
|
||||
const boostMessage = useMemo(() => {
|
||||
if (!item?.parentId) {
|
||||
|
|
Loading…
Reference in New Issue