fix(chat): enable in-place subtask navigation in embedded session-chat iframe (#2138)
This commit is contained in:
@@ -54,6 +54,7 @@ import { MCP_OAUTH_CALLBACK_PATH } from '@/components/sections/mcp/mcpOAuth';
|
||||
import { lazyWithChunkRecovery } from '@/lib/chunkLoadRecovery';
|
||||
import { useI18n } from '@/lib/i18n';
|
||||
import { applyMobileKeyboardMode } from '@/lib/mobileKeyboardMode';
|
||||
import { isEmbeddedSessionChat } from '@/components/layout/contextPanelEmbeddedChat';
|
||||
import { SyncAppEffects } from '@/apps/AppEffects';
|
||||
import { resetAppForRuntimeEndpointChange } from '@/apps/runtimeEndpointReset';
|
||||
import { useAppFontEffects } from '@/apps/useAppFontEffects';
|
||||
@@ -117,15 +118,11 @@ const normalizeEmbeddedDirectory = (value: string | null | undefined): string =>
|
||||
};
|
||||
|
||||
const readEmbeddedSessionChatConfig = (): EmbeddedSessionChatConfig | null => {
|
||||
if (typeof window === 'undefined') {
|
||||
if (typeof window === 'undefined' || !isEmbeddedSessionChat()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
if (params.get('ocPanel') !== 'session-chat') {
|
||||
return null;
|
||||
}
|
||||
|
||||
const sessionIdRaw = params.get('sessionId');
|
||||
const sessionId = typeof sessionIdRaw === 'string' ? sessionIdRaw.trim() : '';
|
||||
if (!sessionId) {
|
||||
@@ -171,7 +168,12 @@ const EmbeddedSessionChatContent: React.FC<{
|
||||
if (expectedDirectory && activeDirectory !== expectedDirectory) return;
|
||||
|
||||
const bootstrapKey = `${expectedDirectory}\n${embeddedSessionChat.sessionId}`;
|
||||
if (bootstrapKeyRef.current === bootstrapKey && currentSessionId === embeddedSessionChat.sessionId) {
|
||||
// Skip if this session was already bootstrapped and a session is still
|
||||
// active — allows in-place navigation (e.g. "Open subtask") to change
|
||||
// currentSessionId without this effect forcing it back. Only re-bootstrap
|
||||
// when currentSessionId was cleared (store init, draft, delete/archive,
|
||||
// runtime-switch remount).
|
||||
if (bootstrapKeyRef.current === bootstrapKey && currentSessionId) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user