Refactor NostrFeed.vue for improved connection handling

- Simplify connection checks by directly accessing the isConnected property of relayHub, enhancing code clarity.
- Update the loadNotes and startRealtimeSubscription functions to reflect the new connection logic, improving maintainability.
This commit is contained in:
padreug 2025-09-05 01:51:11 +02:00
parent 6c1d040e60
commit d33d2abf8a

View file

@ -72,11 +72,11 @@ async function loadNotes() {
error.value = null
// Connect to relay hub if not already connected
if (!relayHub.isConnected.value) {
if (!relayHub.isConnected) {
await relayHub.connect()
}
isConnected.value = relayHub.isConnected.value
isConnected.value = relayHub.isConnected
if (!isConnected.value) {
throw new Error('Failed to connect to Nostr relays')
@ -138,7 +138,7 @@ async function refreshFeed() {
let unsubscribe: (() => void) | null = null
async function startRealtimeSubscription() {
if (!relayHub.isConnected.value) return
if (!relayHub.isConnected) return
try {
const filters: any[] = [{