fix: unable to publish to currently browsed relay

This commit is contained in:
codytseng 2025-08-29 22:35:54 +08:00
parent 1fb2c82bd5
commit 8c9416a6c8
4 changed files with 106 additions and 58 deletions

View file

@ -2,12 +2,20 @@ import Relay from '@/components/Relay'
import RelayPageControls from '@/components/RelayPageControls'
import PrimaryPageLayout from '@/layouts/PrimaryPageLayout'
import { normalizeUrl, simplifyUrl } from '@/lib/url'
import { useCurrentRelays } from '@/providers/CurrentRelaysProvider'
import { Server } from 'lucide-react'
import { forwardRef, useMemo } from 'react'
import { forwardRef, useEffect, useMemo } from 'react'
const RelayPage = forwardRef(({ url }: { url?: string }, ref) => {
const { setTemporaryRelayUrls } = useCurrentRelays()
const normalizedUrl = useMemo(() => (url ? normalizeUrl(url) : undefined), [url])
useEffect(() => {
if (normalizedUrl) {
setTemporaryRelayUrls([normalizedUrl])
}
}, [normalizedUrl])
return (
<PrimaryPageLayout
pageName="relay"