Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

fix(mobile): avoid launch-time WebView prewarm

tianma-if6a469d77c1ee
diff --git a/apps/mobile/src/components/EditorRuntimePrewarm.tsx b/apps/mobile/src/components/EditorRuntimePrewarm.tsx
deleted file mode 100644
index 5821c6d7..00000000
--- a/apps/mobile/src/components/EditorRuntimePrewarm.tsx
+++ /dev/null
@@ -1,15 +0,0 @@
-'use dom';
-
-import type { DOMProps } from "expo/dom";
-
-type EditorRuntimePrewarmProps = {
- dom?: DOMProps;
-};
-
-// Mounting this tiny DOM component after the native workspace is interactive
-// starts the platform WebView runtime without parsing the much larger TipTap
-// editor bundle. The component stays mounted so the renderer remains warm for
-// the first real editor opening.
-export default function EditorRuntimePrewarm(_props: EditorRuntimePrewarmProps) {
- return null;
-}
diff --git a/apps/mobile/src/screens/WorkspaceScreen.tsx b/apps/mobile/src/screens/WorkspaceScreen.tsx
index 054bdc8e..9a4605d9 100644
--- a/apps/mobile/src/screens/WorkspaceScreen.tsx
+++ b/apps/mobile/src/screens/WorkspaceScreen.tsx
@@ -101,7 +101,6 @@ import {
import { AccountSecurityPanel } from "./AccountSecurityModal";
import { beginEditorStartup, markStartup, recordEditorStartup } from "../lib/startup-performance";
import { prepareUploadAsset } from "../lib/mobile-image-upload";
-import EditorRuntimePrewarm from "../components/EditorRuntimePrewarm";
import MobileWebClipCapture from "../components/MobileWebClipCapture";
import { showEdgeEverKeyboard } from "../../modules/edgeever-keyboard";
import LocalTiptapEditor, { type LocalTiptapEditorRef } from "../components/LocalTiptapEditor";
@@ -208,7 +207,6 @@ export const WorkspaceScreen = ({
const [notesActionsOpen, setNotesActionsOpen] = useState(false);
const [notebookPickerOpen, setNotebookPickerOpen] = useState(false);
const [richEditingSession, setRichEditingSession] = useState<RichEditingSession | null>(null);
- const [editorRuntimeWarm, setEditorRuntimeWarm] = useState(false);
const [revisionMemo, setRevisionMemo] = useState<MemoDetail | null>(null);
const [selectionMode, setSelectionMode] = useState(false);
const [selectedMemoIds, setSelectedMemoIds] = useState<Set<string>>(() => new Set());
@@ -348,26 +346,6 @@ export const WorkspaceScreen = ({
return () => task.cancel();
}, []);
- useEffect(() => {
- if (!notebooksQuery.data || !memosQuery.data || editorRuntimeWarm) {
- return;
- }
-
- let timeout: ReturnType<typeof setTimeout> | null = null;
- const task = InteractionManager.runAfterInteractions(() => {
- // Keep first-screen work isolated from Chromium/WebKit startup. A short
- // idle window is still early enough to finish before a normal edit flow.
- timeout = setTimeout(() => setEditorRuntimeWarm(true), 600);
- });
-
- return () => {
- task.cancel();
- if (timeout) {
- clearTimeout(timeout);
- }
- };
- }, [editorRuntimeWarm, memosQuery.data, notebooksQuery.data]);
-
useEffect(() => {
const subscription = BackHandler.addEventListener("hardwareBackPress", () => {
if (selectedMemoId) {
@@ -1106,16 +1084,6 @@ export const WorkspaceScreen = ({
visible={Boolean(selectedMemoId)}
/>
- {editorRuntimeWarm ? (
- <EditorRuntimePrewarm
- dom={{
- bounces: false,
- containerStyle: styles.editorRuntimePrewarm,
- scrollEnabled: false,
- style: styles.editorRuntimePrewarm,
- }}
- />
- ) : null}
{notebookPickerOpen ? <NotebookPickerModal
activeNotebookId={activeNotebookId}
notebooks={notebooks}
diff --git a/apps/mobile/src/screens/workspace-styles.ts b/apps/mobile/src/screens/workspace-styles.ts
index ca9f1e34..d7261914 100644
--- a/apps/mobile/src/screens/workspace-styles.ts
+++ b/apps/mobile/src/screens/workspace-styles.ts
@@ -6,14 +6,6 @@ import { resolveMobileThemeStyles, type MobileResolvedTheme } from "../lib/mobil
const DETAIL_CONTENT_HORIZONTAL_PADDING = 16;
const baseWorkspaceStyles = StyleSheet.create({
- editorRuntimePrewarm: {
- position: "absolute",
- left: -2,
- top: -2,
- width: 1,
- height: 1,
- opacity: 0.01,
- },
safeArea: {
backgroundColor: "#f8fafc",
flex: 1,
diff --git a/tests/mobile-app-scope.test.ts b/tests/mobile-app-scope.test.ts
index 8928a62f..c60038ec 100644
--- a/tests/mobile-app-scope.test.ts
+++ b/tests/mobile-app-scope.test.ts
@@ -28,6 +28,11 @@ describe("mobile app scope", () => {
}
});
+ test("does not initialize a hidden WebView during workspace startup", () => {
+ expect(workspaceSource).not.toContain("EditorRuntimePrewarm");
+ expect(workspaceSource).not.toContain("editorRuntimeWarm");
+ });
+
test("limits account security to the signed-in user", () => {
for (const removedCapability of ["createUser", "listUsers", "updateUser"]) {
expect(accountSecuritySource).not.toContain(removedCapability);