fix: lighten session list payloads (#1538)
* lighten session list * fetch full session on open * sanitize session list * sanitize global sessions * preserve revert markers in session lists * fix: preserve session metadata in list sanitizers --------- Co-authored-by: Bohdan Triapitsyn <artmore@protonmail.com>
This commit is contained in:
committed by
GitHub
co-authored by
Bohdan Triapitsyn
parent
1c274d0a56
commit
9685630436
@@ -0,0 +1,29 @@
|
||||
import { describe, expect, test } from 'bun:test'
|
||||
|
||||
import { shouldFetchSessionForRenderableSync } from './use-sync'
|
||||
|
||||
describe('shouldFetchSessionForRenderableSync', () => {
|
||||
test('fetches full session detail when a lightweight list session is opened', () => {
|
||||
expect(shouldFetchSessionForRenderableSync({
|
||||
hasSession: true,
|
||||
shouldLoadMessages: true,
|
||||
force: false,
|
||||
})).toBe(true)
|
||||
})
|
||||
|
||||
test('skips session detail fetch when session and messages are already ready', () => {
|
||||
expect(shouldFetchSessionForRenderableSync({
|
||||
hasSession: true,
|
||||
shouldLoadMessages: false,
|
||||
force: false,
|
||||
})).toBe(false)
|
||||
})
|
||||
|
||||
test('fetches when the session record is missing', () => {
|
||||
expect(shouldFetchSessionForRenderableSync({
|
||||
hasSession: false,
|
||||
shouldLoadMessages: false,
|
||||
force: false,
|
||||
})).toBe(true)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user