Skip to content

Commit ae43956

Browse files
fix(agentic-cli): keep dashboard subframes in webview
1 parent 9541dda commit ae43956

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

  • app/components/Views/AgenticCliDashboardWebview

app/components/Views/AgenticCliDashboardWebview/index.tsx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { SafeAreaView } from 'react-native-safe-area-context';
44
import { useNavigation } from '@react-navigation/native';
55
import { WebView, WebViewMessageEvent } from '@metamask/react-native-webview';
66
import type {
7+
ShouldStartLoadRequest,
78
WebViewErrorEvent,
89
WebViewHttpErrorEvent,
910
} from '@metamask/react-native-webview/lib/WebViewTypes';
@@ -145,11 +146,26 @@ const AgenticCliDashboardWebview: React.FC = () => {
145146
);
146147

147148
const handleShouldStartLoadWithRequest = useCallback(
148-
(request: { url: string }) => {
149+
(request: ShouldStartLoadRequest) => {
149150
if (AgenticCliDashboardWebviewService.shouldLoadInWebView(request.url)) {
150151
return true;
151152
}
152153

154+
if (!request.isTopFrame) {
155+
return true;
156+
}
157+
158+
if (
159+
request.navigationType !== 'click' &&
160+
request.navigationType !== 'formsubmit'
161+
) {
162+
Logger.log('AgenticCliDashboardWebview: blocked external navigation', {
163+
navigationType: request.navigationType,
164+
url: redactUrlToken(request.url),
165+
});
166+
return false;
167+
}
168+
153169
Linking.openURL(request.url).catch((err) =>
154170
Logger.error(
155171
err as Error,

0 commit comments

Comments
 (0)