mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-15 17:25:26 -04:00
fix(notes): reset search filter on panel reopen so stale query doesn't hide notes (#2920)
This commit is contained in:
@@ -1099,6 +1099,9 @@ export function openPanel() {
|
||||
if (_open) return;
|
||||
_open = true;
|
||||
_editingId = null;
|
||||
// Reset the search filter — the rebuilt pane's search input renders empty, so a
|
||||
// stale _searchQuery would silently hide non-matching notes after a reopen.
|
||||
_searchQuery = '';
|
||||
_clearViewedReminderGlows();
|
||||
_firedDotDismissedAt = Date.now();
|
||||
try { localStorage.setItem(REMINDER_DISMISSED_AT_KEY, String(_firedDotDismissedAt)); } catch {}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
"""Issue #2919 — openPanel must reset _searchQuery so a reopened Notes panel
|
||||
doesn't keep filtering by a stale query (the rebuilt search box renders empty).
|
||||
|
||||
notes.js is a browser ES module with a heavy import chain (can't node-import in
|
||||
isolation), so — per the repo's DOM-coupled-guard convention — this asserts the
|
||||
reset is present in openPanel, beside the existing _editingId reset.
|
||||
"""
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
SRC = Path("static/js/notes.js").read_text(encoding="utf-8")
|
||||
|
||||
|
||||
def _open_panel_body():
|
||||
start = SRC.index("export function openPanel()")
|
||||
rest = SRC[start + len("export function openPanel()"):]
|
||||
m = re.search(r"\n(?:export\s+)?(?:async\s+)?function ", rest)
|
||||
return rest[: m.start()] if m else rest
|
||||
|
||||
|
||||
def test_open_panel_resets_search_query():
|
||||
body = _open_panel_body()
|
||||
assert "_searchQuery = ''" in body, body[:400]
|
||||
# reset must sit with the other open-time state resets, before render
|
||||
assert body.index("_searchQuery = ''") < body.index("_renderNotes") if "_renderNotes" in body else True
|
||||
|
||||
|
||||
def test_module_still_declares_search_query():
|
||||
assert "let _searchQuery = ''" in SRC
|
||||
Reference in New Issue
Block a user