+ {transcriptHydrating && messages.length === 0 ? (
+
+ ) : (
+ <>
{isLoadingMore && (
{t('chat.loadingOlderMessages')}
)}
@@ -1057,6 +1076,8 @@ const ChatPage: React.FC
= ({
/>
+ >
+ )}
diff --git a/src/mobile-web/src/styles/components/chat.scss b/src/mobile-web/src/styles/components/chat.scss
index 0ce4823c24..732743717b 100644
--- a/src/mobile-web/src/styles/components/chat.scss
+++ b/src/mobile-web/src/styles/components/chat.scss
@@ -170,6 +170,15 @@
position: relative;
}
+.chat-page__hydrate {
+ flex: 1;
+ min-height: 0;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ align-self: stretch;
+}
+
.chat-page__load-more-indicator {
text-align: center;
font-size: var(--openbitfun-type-body-xs-font-size);
diff --git a/src/mobile-web/tests/mobile-ui-components.test.mjs b/src/mobile-web/tests/mobile-ui-components.test.mjs
index 50ede3966a..3abd976ff1 100644
--- a/src/mobile-web/tests/mobile-ui-components.test.mjs
+++ b/src/mobile-web/tests/mobile-ui-components.test.mjs
@@ -224,6 +224,27 @@ test('large mobile pages delegate stable UI regions to app components', async ()
assert.doesNotMatch(sessionPage, /createPortal\b/, 'shared sheets own their portal lifecycle');
});
+test('opening a chat keeps a hydrate status until cache or the host snapshot arrives', async () => {
+ const chatPage = await readFile(path.join(sourceDirectory, 'pages/ChatPage.tsx'), 'utf8');
+ const app = await readFile(path.join(sourceDirectory, 'App.tsx'), 'utf8');
+ const chatStyles = await readFile(path.join(sourceDirectory, 'styles/components/chat.scss'), 'utf8');
+ const messages = await readFile(path.join(sourceDirectory, 'i18n/messages.ts'), 'utf8');
+
+ assert.match(chatPage, /\s*0[\s\S]*setTranscriptHydrating\(false\)/);
+ assert.match(chatPage, /resp\.message_snapshot[\s\S]*setTranscriptHydrating\(false\)/);
+ assert.match(chatPage, /className="chat-page__hydrate"/);
+ assert.match(chatPage, /t\('chat\.loadingSession'\)/);
+ assert.match(app, /t\('chat\.loadingSession'\)/);
+ assert.doesNotMatch(app, /fallback=\{ {
const manager = await readFile(path.join(sourceDirectory, 'services/RemoteSessionManager.ts'), 'utf8');
const chatPage = await readFile(path.join(sourceDirectory, 'pages/ChatPage.tsx'), 'utf8');