Skip to content
Source
Sign inSign up
pingdotgg/t3code

perf(clients): saving the thread list cache no longer freezes the UI #13767

Mergedt3dotgg(GitHub profile, opens in a new tab)merged 4 commits intomain fromrefs/pull/13767/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

Showing 5 changed files with 51 additions and 13 deletions (loading 2).

x
0 of 5 viewed, 5 left
13 additions and 6 deletionsapps/mobile/src/connection/environment-cache-store.tsModified
View file
@@ -1,6 +1,7 @@
import {
ConnectionPersistenceError,
EnvironmentCacheStore,
+ encodeShellSnapshotForCache,
} from "@t3tools/client-runtime/platform";
import {
type EnvironmentId,
@@ -56,7 +57,6 @@
const decodeStoredShellSnapshot = Schema.decodeUnknownEffect(
Schema.fromJsonString(StoredShellSnapshot),
);
-const encodeStoredShellSnapshot = Schema.encodeEffect(Schema.fromJsonString(StoredShellSnapshot));
const decodeStoredThreadSnapshot = Schema.decodeUnknownEffect(
Schema.fromJsonString(StoredThreadSnapshot),
);
@@ -136,11 +136,18 @@
}).pipe(Effect.tap(() => Effect.promise(() => projectFaviconDatabaseCache.hydrate()))),
saveShell: Effect.fn("MobileEnvironmentCache.saveShell")(function* (environmentId, snapshot) {
- const payload = yield* encodeStoredShellSnapshot({
- schemaVersion: SHELL_SNAPSHOT_CACHE_SCHEMA_VERSION,
- environmentId,
- snapshot,
- }).pipe(Effect.mapError((cause) => persistenceError("save-shell", cause)));
+ const encodedSnapshot = yield* encodeShellSnapshotForCache(snapshot).pipe(
+ Effect.mapError((cause) => persistenceError("save-shell", cause)),
+ );
+ const payload = yield* Effect.try({