mirror of
https://github.com/dergigi/boris.git
synced 2025-12-23 01:24:19 +01:00
fix: store event in EventStore after updating properties
- Move eventStore.add() call to AFTER updating __highlightProps with final values - This ensures highlights loaded from EventStore have correct isLocalOnly and publishedRelays - Reduce UI logging spam by only logging when values are meaningful - This should fix the airplane icon not showing and reduce excessive re-renders
This commit is contained in:
@@ -117,16 +117,13 @@ export async function createHighlight(
|
||||
// Sign the event
|
||||
const signedEvent = await factory.sign(highlightEvent)
|
||||
|
||||
// Attach custom properties to the event for later retrieval
|
||||
// Initialize custom properties on the event (will be updated after publishing)
|
||||
;(signedEvent as any).__highlightProps = {
|
||||
publishedRelays: [],
|
||||
isLocalOnly: false,
|
||||
isSyncing: false
|
||||
}
|
||||
|
||||
// Store the event in EventStore first for immediate UI display
|
||||
eventStore.add(signedEvent)
|
||||
|
||||
// Publish to all relays and get individual responses
|
||||
const allRelays = RELAYS
|
||||
let publishResponses: { ok: boolean; message?: string; from: string }[] = []
|
||||
@@ -184,6 +181,9 @@ export async function createHighlight(
|
||||
isSyncing: false
|
||||
}
|
||||
|
||||
// Store the event in EventStore AFTER updating with final properties
|
||||
eventStore.add(signedEvent)
|
||||
|
||||
// Mark for offline sync if we're in local-only mode
|
||||
if (isLocalOnly) {
|
||||
console.log('✈️ [HIGHLIGHT-PUBLISH] Marking event for offline sync (flight mode)')
|
||||
@@ -205,6 +205,9 @@ export async function createHighlight(
|
||||
isSyncing: false
|
||||
}
|
||||
|
||||
// Store the event in EventStore AFTER updating with final properties
|
||||
eventStore.add(signedEvent)
|
||||
|
||||
console.log('✈️ [HIGHLIGHT-PUBLISH] Publishing failed, marking for offline sync (flight mode)')
|
||||
const { markEventAsOfflineCreated } = await import('./offlineSyncService')
|
||||
markEventAsOfflineCreated(signedEvent.id)
|
||||
|
||||
Reference in New Issue
Block a user