Sort events in deriveEventsMapped, bump nostr-tools
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@braintree/sanitize-url": "^7.0.2",
|
||||
"nostr-tools": "^2.7.2"
|
||||
"nostr-tools": "^2.14.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"rimraf": "~6.0.0",
|
||||
|
||||
@@ -41,8 +41,8 @@
|
||||
"@tiptap/suggestion": "^2.11.5",
|
||||
"@welshman/lib": "workspace:*",
|
||||
"@welshman/util": "workspace:*",
|
||||
"nostr-editor": "github:cesardeazevedo/nostr-editor#a1babb361e081dd9548b852e15837525a2fc82bc",
|
||||
"nostr-tools": "^2.7.2",
|
||||
"nostr-editor": "github:cesardeazevedo/nostr-editor#98f579b93bd2b5a3344df42f769d2ea4c5d8cf55",
|
||||
"nostr-tools": "^2.14.2",
|
||||
"tippy.js": "^6.3.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -752,6 +752,16 @@ export const ensurePlural = <T>(x: T | T[]) => (x instanceof Array ? x : [x])
|
||||
/** Ensures values are not undefined */
|
||||
export const removeNil = <T>(xs: T[]) => xs.filter(isNotNil).map(assertNotNil)
|
||||
|
||||
/** Returns a list of overlapping pairs of elements in xs */
|
||||
export const overlappingPairs = <T>(xs: T[]): T[][] => {
|
||||
const result: T[][] = []
|
||||
for (let i = 0; i < xs.length - 1; i++) {
|
||||
result.push([xs[i], xs[i + 1]])
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Objects
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
"@welshman/lib": "workspace:*",
|
||||
"@welshman/net": "workspace:*",
|
||||
"@welshman/util": "workspace:*",
|
||||
"nostr-tools": "^2.7.2"
|
||||
"nostr-tools": "^2.14.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@capacitor/core": "^7.2.0",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {derived} from "svelte/store"
|
||||
import {identity, ensurePlural, batch, partition, first} from "@welshman/lib"
|
||||
import {sortBy, identity, ensurePlural, batch, partition, first} from "@welshman/lib"
|
||||
import {Repository} from "@welshman/relay"
|
||||
import {matchFilters, getIdAndAddress, getIdFilters, Filter, TrustedEvent} from "@welshman/util"
|
||||
import {custom} from "./custom.js"
|
||||
@@ -38,7 +38,7 @@ export const deriveEventsMapped = <T>(
|
||||
data.push(item)
|
||||
}
|
||||
|
||||
setter(data)
|
||||
setter(sortBy(item => -itemToEvent(item).created_at, data))
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -59,7 +59,7 @@ export const deriveEventsMapped = <T>(
|
||||
}
|
||||
}
|
||||
|
||||
setter(data)
|
||||
setter(sortBy(item => -itemToEvent(item).created_at, data))
|
||||
|
||||
const onUpdate = batch(300, (updates: {added: TrustedEvent[]; removed: Set<string>}[]) => {
|
||||
const removed = new Set()
|
||||
@@ -109,7 +109,7 @@ export const deriveEventsMapped = <T>(
|
||||
}
|
||||
|
||||
if (dirty) {
|
||||
setter(data)
|
||||
setter(sortBy(item => -itemToEvent(item).created_at, data))
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
"dependencies": {
|
||||
"@welshman/lib": "workspace:*",
|
||||
"@types/ws": "^8.5.13",
|
||||
"nostr-tools": "^2.7.2",
|
||||
"nostr-tools": "^2.14.2",
|
||||
"nostr-wasm": "^0.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -20,6 +20,8 @@ export type RelayProfile = {
|
||||
negentropy?: number
|
||||
description?: string
|
||||
supported_nips?: number[]
|
||||
privacy_policy?: string
|
||||
terms_of_service?: string
|
||||
limitation?: {
|
||||
min_pow_difficulty?: number
|
||||
payment_required?: boolean
|
||||
|
||||
Reference in New Issue
Block a user