fix(ln): skip cache for profile metadata #235

Merged
enes merged 1 commits from issues/234-stale-lnurl into staging 2025-02-27 19:13:59 +00:00
3 changed files with 19 additions and 7 deletions
Showing only changes of commit 72d9b2ac4c - Show all commits

View File

@ -1,3 +1,4 @@
import { NDKSubscriptionCacheUsage } from '@nostr-dev-kit/ndk'
import { Dots } from 'components/Spinner'
import { ZapSplit } from 'components/Zap'
import {
@ -28,7 +29,9 @@ export const Zap = ({ addressable }: ZapProps) => {
useBodyScrollDisable(isOpen)
useDidMount(() => {
findMetadata(addressable.author)
findMetadata(addressable.author, {
cacheUsage: NDKSubscriptionCacheUsage.ONLY_RELAY
})
.then((res) => {
setIsAvailable(typeof res?.lud16 !== 'undefined' && res.lud16 !== '')
})

View File

@ -44,7 +44,7 @@ type Props = {
export const ProfileSection = ({ pubkey }: Props) => {
const { ndk } = useNDKContext()
const profile = useProfile(pubkey, {
cacheUsage: NDKSubscriptionCacheUsage.PARALLEL
cacheUsage: NDKSubscriptionCacheUsage.ONLY_RELAY
})
const displayName =
profile?.displayName || profile?.name || '[name not set up]'
@ -151,7 +151,7 @@ type ProfileProps = {
export const Profile = ({ pubkey }: ProfileProps) => {
const profile = useProfile(pubkey, {
cacheUsage: NDKSubscriptionCacheUsage.PARALLEL
cacheUsage: NDKSubscriptionCacheUsage.ONLY_RELAY
})
const displayName =

View File

@ -1,4 +1,7 @@
import { getRelayListForUser } from '@nostr-dev-kit/ndk'
import {
getRelayListForUser,
NDKSubscriptionCacheUsage
} from '@nostr-dev-kit/ndk'
import { QRCodeSVG } from 'qrcode.react'
import React, {
Dispatch,
@ -318,7 +321,9 @@ export const ZapPopUp = ({
setLoadingSpinnerDesc('Finding receiver metadata')
const receiverMetadata = await findMetadata(receiver)
const receiverMetadata = await findMetadata(receiver, {
cacheUsage: NDKSubscriptionCacheUsage.ONLY_RELAY
})
if (!receiverMetadata?.lud16) {
setIsLoading(false)
@ -552,12 +557,16 @@ export const ZapSplit = ({
const [invoices, setInvoices] = useState<Map<string, PaymentRequest>>()
useDidMount(async () => {
findMetadata(pubkey).then((res) => {
findMetadata(pubkey, {
cacheUsage: NDKSubscriptionCacheUsage.ONLY_RELAY
}).then((res) => {
setAuthor(res)
})
const adminNpubs = import.meta.env.VITE_ADMIN_NPUBS.split(',')
findMetadata(adminNpubs[0]).then((res) => {
findMetadata(adminNpubs[0], {
cacheUsage: NDKSubscriptionCacheUsage.ONLY_RELAY
}).then((res) => {
setAdmin(res)
})
})