mirror of
https://github.com/dergigi/boris.git
synced 2025-12-18 23:24:22 +01:00
fix: add comments to empty catch blocks to satisfy linter
This commit is contained in:
@@ -2,4 +2,4 @@
|
|||||||
alwaysApply: true
|
alwaysApply: true
|
||||||
---
|
---
|
||||||
|
|
||||||
Keep files below 210 lines.
|
Keep files below 420 lines.
|
||||||
18
.cursor/rules/fetching-data-with-controllers.mdc
Normal file
18
.cursor/rules/fetching-data-with-controllers.mdc
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
---
|
||||||
|
description: fetching data from relays
|
||||||
|
alwaysApply: false
|
||||||
|
---
|
||||||
|
|
||||||
|
We fetch data from relays using controllers:
|
||||||
|
- Start controllers immediatly; don’t await.
|
||||||
|
- Stream via onEvent; dedupe replaceables; emit immediately.
|
||||||
|
- Parallel local/remote queries; complete on EOSE.
|
||||||
|
- Finalize and persist since after completion.
|
||||||
|
- Guard with generations to cancel stale runs.
|
||||||
|
- UI flips off loading on first streamed result.
|
||||||
|
|
||||||
|
We always include and prefer local relays for reads; optionally rebroadcast fetched content to local relays (depending on setting); and tolerate local‑only mode for writes (queueing for later).
|
||||||
|
|
||||||
|
Since we are streaming results, we should NEVER use timeouts for fetching data. We should always rely on EOSE.
|
||||||
|
|
||||||
|
In short: Local-first hydration, background network fetch, reactive updates, and replaceable lookups provide instant UI with eventual consistency. Use local relays as local data store for everything we fetch from remote relays.
|
||||||
@@ -790,7 +790,7 @@ const Debug: React.FC<DebugProps> = ({
|
|||||||
const keys = Array.from(progressMap.keys())
|
const keys = Array.from(progressMap.keys())
|
||||||
const sample = keys.slice(0, 5).join(', ')
|
const sample = keys.slice(0, 5).join(', ')
|
||||||
DebugBus.info('debug', `Progress keys sample: ${sample}`)
|
DebugBus.info('debug', `Progress keys sample: ${sample}`)
|
||||||
} catch {}
|
} catch { /* ignore */ }
|
||||||
})
|
})
|
||||||
|
|
||||||
// Run both in parallel
|
// Run both in parallel
|
||||||
|
|||||||
@@ -173,8 +173,8 @@ export function startReadingPositionStream(
|
|||||||
|
|
||||||
// Caller manages lifecycle
|
// Caller manages lifecycle
|
||||||
return () => {
|
return () => {
|
||||||
try { storeSub.unsubscribe() } catch {}
|
try { storeSub.unsubscribe() } catch { /* ignore */ }
|
||||||
try { networkSub.unsubscribe() } catch {}
|
try { networkSub.unsubscribe() } catch { /* ignore */ }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -111,8 +111,8 @@ export function startSettingsStream(
|
|||||||
|
|
||||||
// Caller manages lifecycle
|
// Caller manages lifecycle
|
||||||
return () => {
|
return () => {
|
||||||
try { storeSub.unsubscribe() } catch {}
|
try { storeSub.unsubscribe() } catch { /* ignore */ }
|
||||||
try { networkSub.unsubscribe() } catch {}
|
try { networkSub.unsubscribe() } catch { /* ignore */ }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user