fix(ln): skip cache for profile metadata
This commit is contained in:
parent
700e2e1e4e
commit
72d9b2ac4c
@ -1,3 +1,4 @@
|
|||||||
|
import { NDKSubscriptionCacheUsage } from '@nostr-dev-kit/ndk'
|
||||||
import { Dots } from 'components/Spinner'
|
import { Dots } from 'components/Spinner'
|
||||||
import { ZapSplit } from 'components/Zap'
|
import { ZapSplit } from 'components/Zap'
|
||||||
import {
|
import {
|
||||||
@ -28,7 +29,9 @@ export const Zap = ({ addressable }: ZapProps) => {
|
|||||||
useBodyScrollDisable(isOpen)
|
useBodyScrollDisable(isOpen)
|
||||||
|
|
||||||
useDidMount(() => {
|
useDidMount(() => {
|
||||||
findMetadata(addressable.author)
|
findMetadata(addressable.author, {
|
||||||
|
cacheUsage: NDKSubscriptionCacheUsage.ONLY_RELAY
|
||||||
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
setIsAvailable(typeof res?.lud16 !== 'undefined' && res.lud16 !== '')
|
setIsAvailable(typeof res?.lud16 !== 'undefined' && res.lud16 !== '')
|
||||||
})
|
})
|
||||||
|
@ -44,7 +44,7 @@ type Props = {
|
|||||||
export const ProfileSection = ({ pubkey }: Props) => {
|
export const ProfileSection = ({ pubkey }: Props) => {
|
||||||
const { ndk } = useNDKContext()
|
const { ndk } = useNDKContext()
|
||||||
const profile = useProfile(pubkey, {
|
const profile = useProfile(pubkey, {
|
||||||
cacheUsage: NDKSubscriptionCacheUsage.PARALLEL
|
cacheUsage: NDKSubscriptionCacheUsage.ONLY_RELAY
|
||||||
})
|
})
|
||||||
const displayName =
|
const displayName =
|
||||||
profile?.displayName || profile?.name || '[name not set up]'
|
profile?.displayName || profile?.name || '[name not set up]'
|
||||||
@ -151,7 +151,7 @@ type ProfileProps = {
|
|||||||
|
|
||||||
export const Profile = ({ pubkey }: ProfileProps) => {
|
export const Profile = ({ pubkey }: ProfileProps) => {
|
||||||
const profile = useProfile(pubkey, {
|
const profile = useProfile(pubkey, {
|
||||||
cacheUsage: NDKSubscriptionCacheUsage.PARALLEL
|
cacheUsage: NDKSubscriptionCacheUsage.ONLY_RELAY
|
||||||
})
|
})
|
||||||
|
|
||||||
const displayName =
|
const displayName =
|
||||||
|
@ -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 { QRCodeSVG } from 'qrcode.react'
|
||||||
import React, {
|
import React, {
|
||||||
Dispatch,
|
Dispatch,
|
||||||
@ -318,7 +321,9 @@ export const ZapPopUp = ({
|
|||||||
|
|
||||||
setLoadingSpinnerDesc('Finding receiver metadata')
|
setLoadingSpinnerDesc('Finding receiver metadata')
|
||||||
|
|
||||||
const receiverMetadata = await findMetadata(receiver)
|
const receiverMetadata = await findMetadata(receiver, {
|
||||||
|
cacheUsage: NDKSubscriptionCacheUsage.ONLY_RELAY
|
||||||
|
})
|
||||||
|
|
||||||
if (!receiverMetadata?.lud16) {
|
if (!receiverMetadata?.lud16) {
|
||||||
setIsLoading(false)
|
setIsLoading(false)
|
||||||
@ -552,12 +557,16 @@ export const ZapSplit = ({
|
|||||||
const [invoices, setInvoices] = useState<Map<string, PaymentRequest>>()
|
const [invoices, setInvoices] = useState<Map<string, PaymentRequest>>()
|
||||||
|
|
||||||
useDidMount(async () => {
|
useDidMount(async () => {
|
||||||
findMetadata(pubkey).then((res) => {
|
findMetadata(pubkey, {
|
||||||
|
cacheUsage: NDKSubscriptionCacheUsage.ONLY_RELAY
|
||||||
|
}).then((res) => {
|
||||||
setAuthor(res)
|
setAuthor(res)
|
||||||
})
|
})
|
||||||
|
|
||||||
const adminNpubs = import.meta.env.VITE_ADMIN_NPUBS.split(',')
|
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)
|
setAdmin(res)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user