Logout bug hunt (#294)
* Stop storing the log on disk * Add more info to the session logging * Only clear session tokens from storage when they've expired * Retry session resumption a few times if it's a network issue * Improvements to the 'connecting' screen
This commit is contained in:
parent
94741cdded
commit
3c05a08482
5 changed files with 100 additions and 48 deletions
|
@ -1,6 +1,7 @@
|
|||
import {makeAutoObservable} from 'mobx'
|
||||
import {XRPCError, XRPCInvalidResponseError} from '@atproto/xrpc'
|
||||
import {isObj, hasProp} from 'lib/type-guards'
|
||||
|
||||
const MAX_ENTRIES = 300
|
||||
|
||||
interface LogEntry {
|
||||
id: string
|
||||
|
@ -28,27 +29,14 @@ export class LogModel {
|
|||
entries: LogEntry[] = []
|
||||
|
||||
constructor() {
|
||||
makeAutoObservable(this, {serialize: false, hydrate: false})
|
||||
}
|
||||
|
||||
serialize(): unknown {
|
||||
return {
|
||||
entries: this.entries.slice(-100),
|
||||
}
|
||||
}
|
||||
|
||||
hydrate(v: unknown) {
|
||||
if (isObj(v)) {
|
||||
if (hasProp(v, 'entries') && Array.isArray(v.entries)) {
|
||||
this.entries = v.entries.filter(
|
||||
e => isObj(e) && hasProp(e, 'id') && typeof e.id === 'string',
|
||||
)
|
||||
}
|
||||
}
|
||||
makeAutoObservable(this)
|
||||
}
|
||||
|
||||
private add(entry: LogEntry) {
|
||||
this.entries.push(entry)
|
||||
while (this.entries.length > MAX_ENTRIES) {
|
||||
this.entries = this.entries.slice(50)
|
||||
}
|
||||
}
|
||||
|
||||
debug(summary: string, details?: any) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue