Skip to content

Commit

Permalink
fix: globally pinned items rank in global
Browse files Browse the repository at this point in the history
  • Loading branch information
Soxasora committed Jan 22, 2025
1 parent 90ccbc5 commit b45aa77
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions api/typeDefs/item.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ export default gql`
comments(sort: String): [Item!]!
path: String
position: Int
pinId: Int
prior: Int
isJob: Boolean!
pollCost: Int
Expand Down
3 changes: 1 addition & 2 deletions components/items.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ export default function Items ({ ssrData, variables = DEFAULT_VARIABLES, query,

const itemsWithPins = useMemo(() => {
if (!pins) return items

const res = [...items]
const res = items.filter(item => !item.pinId)
pins?.forEach(p => {
if (p.position <= res.length) {
res.splice(p.position - 1, 0, p)
Expand Down
1 change: 1 addition & 0 deletions fragments/items.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const ITEM_FIELDS = gql`
}
otsHash
position
pinId
sats
credits
meAnonSats @client
Expand Down

0 comments on commit b45aa77

Please sign in to comment.