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:
Hristo Karamanliev
2026-06-11 23:06:19 +03:00
committed by GitHub
co-authored by Bohdan Triapitsyn
parent 1c274d0a56
commit 9685630436
8 changed files with 701 additions and 39 deletions
+29
View File
@@ -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)
})
})