Skip to content

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

fix(search): keep untitled notes in results after local saves (#769)

LuoQianhong657170fa03cd
diff --git a/apps/web/src/lib/local-mirror.ts b/apps/web/src/lib/local-mirror.ts
index be7bd04c..6ac64792 100644
--- a/apps/web/src/lib/local-mirror.ts
+++ b/apps/web/src/lib/local-mirror.ts
@@ -1,4 +1,5 @@
import {
+ DEFAULT_MEMO_TITLE,
createExcerpt,
docToMarkdown,
docToText,
@@ -260,7 +261,7 @@ export const listLocalMemos = async (scope: string, params: LocalMemoListParams)
if (params.filter === "tagged" && memo.tags.length === 0) return false;
if (params.filter === "untagged" && memo.tags.length > 0) return false;
if (params.filter === "pinned" && !memo.isPinned) return false;
- if (q && ![memo.title, memo.excerpt, memo.contentText, memo.tags.join(" ")].some((value) => value?.toLocaleLowerCase().includes(q))) return false;
+ if (q && ![memo.title || DEFAULT_MEMO_TITLE, memo.excerpt, memo.contentText, memo.tags.join(" ")].some((value) => value?.toLocaleLowerCase().includes(q))) return false;
return true;
});
diff --git a/crates/desktop-sidecar/src/memo.rs b/crates/desktop-sidecar/src/memo.rs
index 1234bb62..a76235de 100644
--- a/crates/desktop-sidecar/src/memo.rs
+++ b/crates/desktop-sidecar/src/memo.rs
@@ -453,7 +453,7 @@ pub(crate) fn list_memos(database: &Connection, params: &Value) -> Result<Value,
.unwrap_or(0)
.max(0);
let where_clause = format!(
- "m.is_deleted = ?1 AND (?2 = '' OR lower(COALESCE(m.title, '') || ' ' || m.excerpt || ' ' || c.content_text || ' ' || m.tags_json) LIKE '%' || lower(?2) || '%')
+ "m.is_deleted = ?1 AND (?2 = '' OR lower(COALESCE(NULLIF(m.title, ''), '无标题笔记') || ' ' || m.excerpt || ' ' || c.content_text || ' ' || m.tags_json) LIKE '%' || lower(?2) || '%')
AND (?3 IS NULL OR m.notebook_id = ?3)
AND (?4 = '[]' OR m.notebook_id IN (SELECT value FROM json_each(?4)))
AND (?5 = '' OR EXISTS (
diff --git a/docs/changes/2026-11-02-search-edit-results.md b/docs/changes/2026-11-02-search-edit-results.md
new file mode 100644
index 00000000..1687ef40
--- /dev/null
+++ b/docs/changes/2026-11-02-search-edit-results.md
@@ -0,0 +1,49 @@
+# Keep search results correct while editing notes
+
+## Problem and goal
+
+[Issue #751](https://github.com/tianma-if/edgeever/issues/751) reports that on Windows v2.16.1, editing a search result containing PDF/ZIP attachments (for example, deleting a ZIP attachment) immediately makes the note disappear. Clearing and repeating the search restores it. A note that still matches the search must remain visible and editable after edits and autosave.
+
+The additional screenshots search for `无标题笔记` (the canonical untitled label). The unmodified official macOS v2.16.1 client reproduces the failure with the same default title, four images, PDF/ZIP attachments, and Chinese/English body text: deleting the ZIP changes the local title from the default string to `null`, reducing three results to two. Server synchronization normalizes it back to the default string, and repeating the search restores three results. The attachment is not a required search condition; local empty titles and the server default have inconsistent search semantics.
+
+## Allowed changes
+
+- Fix search-result updates during editing and saving so a note that still satisfies the search, notebook, tag, and filter constraints remains visible and selected. Reuse the existing search, list cache, Repository, and save entry points.
+- Search in the Web local mirror and desktop sidecar treats `null` or empty-string titles as the existing canonical default `无标题笔记`, matching server title normalization. Do not rewrite locally saved titles or change matching for other nonempty titles, body text, tags, or localized display labels.
+- Preserve genuine search-membership changes: deleting the only matching text must not permanently retain a nonmatching note. Repeating the search must agree with the saved content.
+- Extend the existing end-to-end tests with a regression that fails on the original implementation before applying the fix. Cover editing a searched note with PDF/ZIP attachments, autosave, further editing, and repeating the search. Include a body-only search term beyond the excerpt so a summary cannot substitute for full-text matching. Add isolated tests only for concrete behavior that end-to-end coverage cannot effectively exercise.
+- Reuse browser end-to-end coverage and the native sidecar's real JSON-RPC/SQLite tests. Keep untitled notes in search before synchronization, after the server acknowledgement, and when repeating the search; renaming to an explicit nonmatching title must still remove the note. Verify that the fix reads existing empty-title data created by the official native client without a migration.
+
+## Unchanged boundaries
+
+No new search syntax, filters, settings, network retries, or request fallbacks. Preserve attachment-deletion permissions and semantics, autosave timing, sorting contracts, and pagination protocols. Do not change database schemas, migrations, authentication, sync protocols, native installation, or automatic updates. Add no dependencies and publish no release. Leave unrelated work untouched.
+
+## Risks and rollback
+
+Incorrect result reconciliation could hide matching notes, retain nonmatching notes, or switch the active editor. Verify the actual interface, saved content, and selected note. Reverting the related code restores the previous implementation without a data migration. Native Windows validation is outstanding; browser evidence does not replace it.
+
+## Acceptance
+
+Run the focused end-to-end regressions and inspect the actual interface. Run `bun run typecheck`, `bun run typecheck:mobile`, and `bun run build:web`. Reconcile the final diff against this scope and distinguish code checks, native-platform validation, commits, pushes, and deployments.
+
+## Implementation decision
+
+Normalize empty-title semantics in queries rather than changing saved values or waiting for synchronization to refresh the list. This also handles existing local empty-title notes while preserving saving, synchronization, and data formats. Desktop rows and counts continue to share one search condition; Web still filters the existing local mirror. No queries or reads are added. Existing custom-title and body-text matching remains unchanged.
+
+The browser regression uses the minimal trigger, editing the body of an untitled search result, rather than treating attachment contents as a prerequisite. The native-client scenario covers actual attachment deletion.
+
+## Completion check
+
+- Product changes are limited to the local search field in `apps/web/src/lib/local-mirror.ts` and the search condition in `crates/desktop-sidecar/src/memo.rs`. Empty titles match the canonical default during queries; locally saved titles remain `null`. No migrations, queries, input restrictions, or synchronization policies were added.
+- The new browser regression first confirmed that the original implementation loses the selected result after a local body save with a `null` title. All 3 Chromium scenarios in `tests/e2e/note-search.spec.ts` pass after the fix. The new case covers local saves, further editing, and clearing/repeating the search. After releasing the real synchronization response, it waits for the acknowledgement to reach the local mirror before checking that all three results and the current editor contents remain. An explicit nonmatching rename correctly reduces three results to two.
+- The native JSON-RPC/SQLite regression first exposed the missing result with the official v2.16.1 sidecar; `bun scripts/test-desktop-sidecar.mjs` passes after the fix. The fixed binary also read the existing empty-title data left by that old version: the title remained `null`, the note matched, and its contents were identical before and after querying.
+- The official macOS v2.16.1 runtime with the fixed sidecar was tested against isolated data and a real local API using four images, Chinese/English body text, and PDF/ZIP attachments. Deleting the ZIP and PDF retained all three search results, the active note, further edits, and all four images. Repeating the search after synchronization also worked. The actual interface was inspected; see the comparison below.
+- `bun run typecheck`, `bun run typecheck:mobile`, and `bun run build:web` pass. Native Windows and Linux interfaces remain untested. Release-package installation and automatic updates were not exercised in this task.
+
+### Before: deleting the ZIP leaves two results and switches the editor to another note
+
+![Before: the active note disappears from search](evidence/2026-11-02-search-edit-results/release-after-delete.png)
+
+### After: deleting both the ZIP and PDF retains three results and continued editing
+
+![After: the active note and four images remain](evidence/2026-11-02-search-edit-results/fixed-after-delete.png)
diff --git a/docs/changes/2026-11-02-search-edit-results.zh-CN.md b/docs/changes/2026-11-02-search-edit-results.zh-CN.md
new file mode 100644
index 00000000..8bc72e83
--- /dev/null
+++ b/docs/changes/2026-11-02-search-edit-results.zh-CN.md
@@ -0,0 +1,49 @@
+# 搜索后编辑笔记时保留正确结果
+
+## 问题与目标
+
+[Issue #751](https://github.com/tianma-if/edgeever/issues/751) 报告 Windows v2.16.1 中,搜索笔记后编辑含 PDF、ZIP 附件的笔记(例如删除 ZIP)会使笔记立即消失,清空并重新搜索才恢复。目标是让仍匹配搜索条件的笔记在编辑、自动保存后继续可见,并保留当前编辑对象。
+
+补充截图中的搜索词为“无标题笔记”。在未修改的 macOS 正式 v2.16.1 中,使用同样的默认标题、4 张图片、PDF/ZIP 及中英文正文已复现:删除 ZIP 后,本地标题从默认字符串变成 `null`,搜索结果由 3 条变成 2 条;云端同步将标题规范化为默认字符串后,重新搜索又恢复 3 条。附件不是必要的搜索条件,问题在于本地空标题与云端默认标题的搜索含义不一致。
+
+## 允许的变更清单
+
+- 修复搜索结果在编辑和保存过程中的更新,使仍匹配当前搜索、笔记本、标签和筛选条件的笔记保持可见、可继续编辑;复用现有搜索、列表缓存、Repository 与保存入口。
+- Web 本地镜像和桌面 sidecar 搜索将 `null` 或空字符串标题按既有规范默认值 `无标题笔记` 匹配,与服务端标题规范化一致;不改写本地保存的标题,不改变其他非空标题、正文、标签的匹配方式或本地化展示。
+- 保留真实的搜索结果变化:删除唯一匹配的文本后,不得把不再符合条件的笔记永久保留在结果中;重新搜索应与保存后的内容一致。
+- 在现有端到端测试中增加可复现缺陷的场景,先确认原实现失败,再验证修复。覆盖搜索后编辑含 PDF/ZIP 附件的笔记、自动保存、继续编辑与重新搜索;检验正文中位于摘要之外的搜索词,避免用摘要代替全文判断。只有端到端无法有效覆盖的具体行为才补充隔离测试。
+- 复用浏览器端到端测试和原生 sidecar 的真实 JSON-RPC/SQLite 测试。验证默认标题笔记在本地未同步、云端回执到达和重新搜索时均保留;改为不匹配的明确标题后正常移出结果。以原生正式版产生的本地空标题数据验证修复版读取,无需迁移。
+
+## 保持不变的边界
+
+不新增搜索语法、筛选项、配置、网络重试或调用兜底;不改变附件删除权限、资源删除语义、自动保存延迟、排序契约或分页协议。不修改数据库结构、迁移、认证、同步协议、原生安装与自动升级机制,不新增依赖,不发布版本。不处理其他任务的改动。
+
+## 风险与回滚
+
+错误的结果协调可能使仍匹配的笔记消失、误留不匹配笔记或切换当前编辑对象。使用真实界面和保存后读回验证结果与编辑对象;回退本次相关代码即可恢复原实现,无需数据迁移。Windows 原生客户端尚未验证,不能用浏览器结果替代。
+
+## 验收方式
+
+运行上述定向端到端回归,检查实际界面;运行 `bun run typecheck`、`bun run typecheck:mobile` 与 `bun run build:web`。完成后以实际 diff 双向核对本清单,并区分代码验证、原生平台验证、提交、推送与部署状态。
+
+## 实施决策
+
+采用查询侧统一空标题含义,而不修改保存值或等待同步后再刷新;这样也能读取已有本地空标题笔记,并保持保存、同步和数据格式不变。桌面列表与计数继续共用同一个搜索条件,Web 仍在既有本地镜像中筛选,不增加查询或读取次数。自定义标题与正文搜索的原有逻辑不变。
+
+浏览器自动回归使用“默认标题 → 修改正文”这个最小触发场景,避免把附件内容当成必要条件;真实附件删除由原生客户端场景覆盖。
+
+## 完成核对
+
+- 产品改动仅涉及 `apps/web/src/lib/local-mirror.ts` 的本地搜索字段,以及 `crates/desktop-sidecar/src/memo.rs` 的搜索条件;空标题在查询时匹配规范默认标题,本地保存值仍为 `null`,未增加迁移、查询、输入限制或同步策略。
+- 浏览器新增回归在原实现下确认:本地正文已保存、标题为 `null` 时,搜索结果中的当前笔记消失。修复后 `tests/e2e/note-search.spec.ts` 的 3 个 Chromium 场景通过;新增场景覆盖本地保存、继续编辑、清空后重新搜索。放行真实同步响应后,等待回执写入本地镜像,再确认 3 条结果和当前编辑内容仍保留;改为不匹配标题后正常从 3 条变成 2 条。
+- 原生 JSON-RPC/SQLite 回归在正式 v2.16.1 sidecar 下先暴露漏搜,修复后 `bun scripts/test-desktop-sidecar.mjs` 通过。修复版还直接读取了该旧版留下的空标题数据:标题仍为 `null`,能够命中搜索,查询前后的笔记内容完全一致。
+- macOS 正式 v2.16.1 运行时搭配修复后的 sidecar,在隔离数据与真实本地 API 中验证了 4 张图片、中英文正文和 PDF/ZIP:连续删除 ZIP、PDF 后,仍有 3 条搜索结果,当前笔记和后续编辑保留,4 张图片保持完整;同步后重新搜索仍正常。已检查实际界面,见下方对比。
+- `bun run typecheck`、`bun run typecheck:mobile`、`bun run build:web` 均通过。Windows、Linux 原生界面尚未实测;本任务未进行发行包安装或自动升级验收。
+
+### 修复前:删除 ZIP 后只剩 2 条结果,编辑器跳到另一条笔记
+
+![修复前,搜索结果丢失当前笔记](evidence/2026-11-02-search-edit-results/release-after-delete.png)
+
+### 修复后:删除 ZIP 和 PDF 后仍有 3 条结果,可以继续编辑
+
+![修复后,当前笔记与四张图片保留](evidence/2026-11-02-search-edit-results/fixed-after-delete.png)
diff --git a/docs/changes/evidence/2026-11-02-search-edit-results/fixed-after-delete.png b/docs/changes/evidence/2026-11-02-search-edit-results/fixed-after-delete.png
new file mode 100644
index 00000000..7114743b
Binary files /dev/null and b/docs/changes/evidence/2026-11-02-search-edit-results/fixed-after-delete.png differ
diff --git a/docs/changes/evidence/2026-11-02-search-edit-results/release-after-delete.png b/docs/changes/evidence/2026-11-02-search-edit-results/release-after-delete.png
new file mode 100644
index 00000000..51a28451
Binary files /dev/null and b/docs/changes/evidence/2026-11-02-search-edit-results/release-after-delete.png differ
diff --git a/scripts/test-desktop-sidecar.mjs b/scripts/test-desktop-sidecar.mjs
index 6f0683ad..91168c66 100644
--- a/scripts/test-desktop-sidecar.mjs
+++ b/scripts/test-desktop-sidecar.mjs
@@ -190,6 +190,31 @@ assert.equal(search.memos[0].structuredTable, false, "an ordinary note is not a
assert.equal(Object.hasOwn(search.memos[0], "diagramPreview"), false);
assert.equal(Object.hasOwn(search.memos[0], "tablePreview"), false);
assert.equal(Object.hasOwn(search.memos[0], "contentMarkdown"), false, "list rows must not include the document payload");
+
+// #751: the editor sends an empty title for an untitled note. Local saves keep
+// that as null, while the server returns the canonical default after sync.
+const untitled = (await request("memo.create", {
+ notebookId: inbox.id, title: "无标题笔记", contentMarkdown: "English 正文", tags: [],
+})).memo;
+const searchUntitled = () => request("memo.list", { notebookId: inbox.id, q: "无标题笔记", limit: 20 });
+assert.deepEqual((await searchUntitled()).memos.map((memo) => memo.id), [untitled.id]);
+const editedUntitled = (await request("memo.update", {
+ memoId: untitled.id, expectedRevision: untitled.revision, expectedContentHash: untitled.contentHash,
+ title: "", contentJson: { type: "doc", content: [{ type: "paragraph", content: [{ type: "text", text: "English 正文 edited" }] }] },
+ contentMarkdown: "English 正文 edited", contentText: "English 正文 edited", tags: [],
+})).memo;
+assert.equal(editedUntitled.title, null, "search must not rewrite the saved title");
+const untitledResults = await searchUntitled();
+assert.deepEqual(untitledResults.memos.map((memo) => memo.id), [untitled.id], "local autosave must not hide an untitled search result");
+assert.equal(untitledResults.totalCount, 1, "search count must include the local null title");
+await request("memo.update", {
+ memoId: untitled.id, expectedRevision: editedUntitled.revision, expectedContentHash: editedUntitled.contentHash,
+ title: "Explicit title", contentJson: editedUntitled.contentJson,
+ contentMarkdown: editedUntitled.contentMarkdown, contentText: editedUntitled.contentText, tags: [],
+});
+assert.equal((await searchUntitled()).totalCount, 0, "a genuinely nonmatching title must leave the search");
+await request("memo.delete", { memoId: untitled.id, permanent: true });
+
const assertListMetadata = async (title, markdown) => {
const created = await request("memo.create", { notebookId: inbox.id, title, contentMarkdown: markdown, tags: [] });
const listed = (await request("memo.list", { q: title, limit: 20 })).memos.find((memo) => memo.id === created.memo.id);
@@ -606,4 +631,4 @@ for (const key of Object.keys(appearance)) assert.equal((await readAppearance())
child.stdin.end();
await new Promise((resolve) => child.once("close", resolve));
-console.log(JSON.stringify({ ok: true, checked: ["notebook.appearance.roundtrip-sync-rollback", "memo.create", "memo.list.search", "memo.list.noteKind", "memo.list.tag", "memo.list.subtree", "memo.update", "memo.update.coalesce", "memo.revisions", "memo.restoreRevision", "memo.revision.cache", "tag.rename", "memo.moveBatch", "memo.pinBatch", "memo.deleteBatch", "memo.restore", "memo.emptyTrash", "memo.merge", "template.cache", "template.create.payload", "template.delete", "storage.backup", "storage.backups", "storage.restore", "sync.apply.merge-page-order", "sync.apply.deleted-notebook", "sync.apply.renamed-inbox", "sync.outbox", "sync.outbox.notebook-remap", "sync.outbox.notebook-remap-rollback", "sync.outbox.retry", "sync.outbox.recoverMemoUpdate", "sync.outbox.discard", "notebook.delete.empty-tree", "notebook.delete.not-empty"] }));
+console.log(JSON.stringify({ ok: true, checked: ["notebook.appearance.roundtrip-sync-rollback", "memo.create", "memo.list.search", "memo.list.untitled", "memo.list.noteKind", "memo.list.tag", "memo.list.subtree", "memo.update", "memo.update.coalesce", "memo.revisions", "memo.restoreRevision", "memo.revision.cache", "tag.rename", "memo.moveBatch", "memo.pinBatch", "memo.deleteBatch", "memo.restore", "memo.emptyTrash", "memo.merge", "template.cache", "template.create.payload", "template.delete", "storage.backup", "storage.backups", "storage.restore", "sync.apply.merge-page-order", "sync.apply.deleted-notebook", "sync.apply.renamed-inbox", "sync.outbox", "sync.outbox.notebook-remap", "sync.outbox.notebook-remap-rollback", "sync.outbox.retry", "sync.outbox.recoverMemoUpdate", "sync.outbox.discard", "notebook.delete.empty-tree", "notebook.delete.not-empty"] }));
diff --git a/tests/e2e/note-search.spec.ts b/tests/e2e/note-search.spec.ts
index 987fdc4c..78ee8026 100644
--- a/tests/e2e/note-search.spec.ts
+++ b/tests/e2e/note-search.spec.ts
@@ -1,4 +1,5 @@
import { expect, test, type Page } from "@playwright/test";
+import { DEFAULT_MEMO_TITLE, type MemoDetail } from "@edgeever/shared";
const createMemo = async (page: Page, contentMarkdown: string) => {
const notebooks = await (await page.request.get("/api/v1/notebooks")).json() as { notebooks: Array<{ id: string }> };
@@ -38,6 +39,97 @@ const searchQuery = (page: Page) => page.getByPlaceholder("在当前笔记内搜
const replaceAll = (page: Page) => page.getByRole("button", { name: "全部替换", exact: true });
const readSource = async (page: Page) => (await page.locator(".cm-content .cm-line").allTextContents()).join("\n");
+const readLocalMemo = (page: Page, memoId: string) => page.evaluate((id) => new Promise<MemoDetail | undefined>((resolve, reject) => {
+ const open = indexedDB.open("edgeever-local");
+ open.onerror = () => reject(open.error);
+ open.onsuccess = () => {
+ const database = open.result;
+ const request = database.transaction("memos", "readonly").objectStore("memos").getAll();
+ request.onerror = () => { database.close(); reject(request.error); };
+ request.onsuccess = () => {
+ database.close();
+ resolve(request.result.find((memo: MemoDetail) => memo.id === id));
+ };
+ };
+}), memoId);
+
+test("keeps an untitled search result after a local body save", async ({ page, request }) => {
+ const notebookResponse = await request.post("/api/v1/notebooks", { data: { name: `Untitled search ${Date.now()}` } });
+ expect(notebookResponse.ok()).toBe(true);
+ const { notebook } = await notebookResponse.json() as { notebook: { id: string; name: string } };
+ const memoIds: string[] = [];
+ let releaseSync = () => {};
+ const syncGate = new Promise<void>((resolve) => { releaseSync = resolve; });
+ try {
+ for (const contentMarkdown of ["First note", "Second note", "这是一个测试笔记。 English text."]) {
+ const response = await request.post("/api/v1/memos", { data: { notebookId: notebook.id, contentMarkdown } });
+ expect(response.status()).toBe(201);
+ const { memo } = await response.json() as { memo: MemoDetail };
+ memoIds.push(memo.id);
+ }
+ const memoId = memoIds[2]!;
+ // Keep the local-save phase observable even when the test server is fast.
+ await page.route(`**/api/v1/memos/${memoId}`, async (route) => {
+ if (route.request().method() !== "PATCH") return route.continue();
+ const response = await route.fetch();
+ await syncGate;
+ await route.fulfill({ response });
+ });
+ await page.goto("/");
+ await page.locator('[data-notebook-tree-button="true"]').filter({ hasText: notebook.name }).click();
+ const search = page.getByPlaceholder("搜索笔记");
+ await search.fill(DEFAULT_MEMO_TITLE);
+ await expect(page.locator("[data-memo-id]")).toHaveCount(3);
+ const card = page.locator(`[data-memo-id="${memoId}"]`);
+ await card.locator("button").first().click();
+ const title = page.getByPlaceholder("无标题笔记");
+ await expect(title).toHaveValue("");
+ const editor = page.locator(".ProseMirror[contenteditable='true']");
+ await editor.locator("p").first().click();
+ await page.keyboard.press("End");
+ await page.keyboard.insertText(" local-body-edit");
+ await expect.poll(async () => (await readLocalMemo(page, memoId))?.contentText).toContain("local-body-edit");
+ expect((await readLocalMemo(page, memoId))?.title).toBeNull();
+ await expect(card).toBeVisible({ timeout: 3000 });
+ await expect(page.locator("[data-memo-id]")).toHaveCount(3);
+
+ await page.keyboard.insertText(" 继续编辑仍保留");
+ await expect.poll(async () => (await readLocalMemo(page, memoId))?.contentText).toContain("继续编辑仍保留");
+ await search.fill("");
+ await search.fill(DEFAULT_MEMO_TITLE);
+ await expect(card).toBeVisible();
+ await expect(page.locator("[data-memo-id]")).toHaveCount(3);
+ await expect(editor).toContainText("继续编辑仍保留");
+
+ releaseSync();
+ await editor.click();
+ await page.keyboard.press("ControlOrMeta+s");
+ await expect.poll(async () => {
+ const result = await (await request.get(`/api/v1/memos/${memoId}`)).json() as { memo: MemoDetail };
+ return result.memo.contentText;
+ }, { timeout: 20000 }).toContain("继续编辑仍保留");
+ // Observe the applied acknowledgement, not only the server write.
+ await expect.poll(async () => (await readLocalMemo(page, memoId))?.title).toBe(DEFAULT_MEMO_TITLE);
+ await expect(card).toBeVisible();
+ await expect(page.locator("[data-memo-id]")).toHaveCount(3);
+ await expect(editor).toContainText("继续编辑仍保留");
+
+ // Real title changes still change search membership.
+ await title.fill("Renamed note");
+ await expect.poll(async () => (await readLocalMemo(page, memoId))?.title).toBe("Renamed note");
+ await expect(card).toHaveCount(0);
+ await expect(page.locator("[data-memo-id]")).toHaveCount(2);
+ } finally {
+ releaseSync();
+ if (!page.isClosed()) await page.unrouteAll({ behavior: "wait" });
+ for (const id of memoIds) {
+ await request.delete(`/api/v1/memos/${id}`);
+ await request.delete(`/api/v1/memos/${id}?permanent=1`);
+ }
+ await request.delete(`/api/v1/notebooks/${notebook.id}`);
+ }
+});
+
test("source search replaces literal escapes with empty text, supports undo, and persists the result", async ({ page }) => {
const memo = await createMemo(page, "# Search regression\n\n**bold** \\\\alpha \\[literal\\] $& \\\\beta\n\nspace end");
const errors: string[] = [];