What happened?
Typing any search query containing a field filter (e.g. tag:meeting) into the search opened from the main Notes list on Android crashes with:
TypeError: Cannot read property 'where' of undefined
Plain full-text queries work fine. The same filter query also works fine when search is opened from inside a notebook, a tag, or Favorites — only the main Notes list is affected.
Likely root cause: The Search screen reads the note selector from route.params.items (apps/mobile/app/screens/search/index.tsx, case "note" → db.lookup.notesWithHighlighting(query, route.params.items, ...)). All routes pass an items selector (e.g. Favorites passes db.notes.favorites, Notebook passes a relations selector) — except the Home screen (apps/mobile/app/screens/home/index.tsx), whose Navigation.push("Search", {...}) omits items entirely.
In packages/core/src/api/lookup.ts, notesWithHighlighting() then hits notes = notes.where(...) inside the if (filters > 0) branch with notes === undefined. That's why only filtered queries crash: plain queries never enter that branch. Note that the sibling method Lookup.notes() has a notes || this.db.notes.all fallback, but notesWithHighlighting() does not.
Suggested fix: either pass items: db.notes.all from the Home screen, or add the same fallback (notes ||= this.db.notes.all) in notesWithHighlighting().
Steps to reproduce the problem
- Open Notesnook on Android
- Go to the main Notes list (home screen)
- Tap the search icon
- Type any query with a field filter, e.g. tag:meeting (the tag doesn't need to exist)
- The app throws the TypeError
Version
App version: 3.4.6 Platform: android Model: google-Pixel 10 Pro Fold-17
Platform/OS
Android
Relevant log output
TypeError: Cannot read property 'where' of undefined
at ?anon_0_ (address at index.android.bundle:1:4156986)
at next (native)
at fulfilled (address at index.android.bundle:1:4154858)
at tryCallOne (address at InternalBytecode.js:1:1180)
at anonymous (address at InternalBytecode.js:1:1874)
What happened?
Typing any search query containing a field filter (e.g.
tag:meeting) into the search opened from the main Notes list on Android crashes with:TypeError: Cannot read property 'where' of undefinedPlain full-text queries work fine. The same filter query also works fine when search is opened from inside a notebook, a tag, or Favorites — only the main Notes list is affected.
Likely root cause: The Search screen reads the note selector from
route.params.items(apps/mobile/app/screens/search/index.tsx,case "note"→db.lookup.notesWithHighlighting(query, route.params.items, ...)). All routes pass anitemsselector (e.g. Favorites passesdb.notes.favorites, Notebook passes a relations selector) — except the Home screen (apps/mobile/app/screens/home/index.tsx), whoseNavigation.push("Search", {...})omitsitemsentirely.In
packages/core/src/api/lookup.ts,notesWithHighlighting()then hitsnotes = notes.where(...)inside theif (filters > 0)branch withnotes === undefined. That's why only filtered queries crash: plain queries never enter that branch. Note that the sibling methodLookup.notes()has anotes || this.db.notes.allfallback, butnotesWithHighlighting()does not.Suggested fix: either pass
items: db.notes.allfrom the Home screen, or add the same fallback (notes ||= this.db.notes.all) innotesWithHighlighting().Steps to reproduce the problem
Version
App version: 3.4.6 Platform: android Model: google-Pixel 10 Pro Fold-17
Platform/OS
Android
Relevant log output