Blog
Privacy for everyone
LoginSign up
Notesnook

Notesnook v3.0.1

Abdullah AttaMay 01, 2024

Notesnook v3.0.1 fixes 20+ bugs via 65+ commits. This release adds SQL based search, improves editor performance & add support for multiline search replace in editor.

SQL Based Search

Notesnook now supports the full FTS5 search syntax. Here's a quick summary about what it'll enable:

  • Wrap a phrase in quotes (e.g. "<phrase>") to run exact search
  • Simple queries (such as "best blog ideas") will look for the words best, blog & ideas and show all notes that contain these words regardless of their sequence.
  • You can use boolean operators OR, AND & NOT to further narrow down results. For example: notesnook OR evernote will show all notes that either have the word notesnook or evernote in them.

The FTS5 query syntax supports a lot of functionality which you can read about here.

Multiline search & replace

You can now search and replacing across lines using Regex.

Multiline search & replace.
Multiline search & replace.

I have also improved the overall UX of search replace so it now works much more smoothly:

  1. Turning on Regex search automatically reruns the search without you having to press Enter again. Same for toggling other things like Match whole word, Match case etc.
  2. Shift + Enter moves to the previous search result.

Fixed database disk image is malformed error on sync

This error occured whenever the sync engine tried to update a deleted note or content item. Deleted items have the following structure:

{
  "id": "some_long_hex_id",
  "deleted": true,
  "dateModified": 100000000000,
  "synced": true
}

Whenever a content or a note item is updated, NN runs an SQLite trigger that updates the FTS5 search index with the new values. This worked in most cases but when it tried to update the index based on the deleted item, it didn't find the required fields (noteId & data) resulting in the above error. The bug didn't affect any data or cause any permanent corruption.

The fix was to only run the trigger if and only if the item isn't deleted and has all the required fields.

You can review the changes in this PR: #4957.

Fixed editor crash with error Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.

Upgrading to React 18 brought with it a bunch of stupid crashes. This particular crash occurs in such a way that there's no way to catch it. Let's start from the beginning:

In order to render custom react node views inside the editor, we have to use React Portals. However, ProseMirror doesn't actually support the React way of doing things. ProseMirror is 100% synchronous while React is asynchronous and operates on a virtual dom. The problem occurs when ProseMirror removes a DOM node which is still present in React's Virtual DOM resulting in the above crash.

That's not all, using React Portals also causes recursive & excessive updates to the underlying node view making the editor super slow as the number of custom node views increase (e.g. too many task items in a task list). I haven't investigated why this happens, though.

In any case, the fix was to get rid of React Portals and use a new React 18 createRoot for every node view. Sounds excessive but trust me, it works much more smoothly. The only loss is that now node views don't share the parent context which isn't a huge deal: the only context we require is the Theme which can be reapplied as necessary.

Before this change, it took 12 seconds to check 100 task items. Now it takes 1 second.

You can review the full changes in this PR #5028

Other fixes

  • Fixed moving notebook on iOS (43fac7901)
  • Fixed scrolling broken in reminder -> repeat -> month (167c54578)
  • Fixed theme search returns empty results (c8c75d40d)
  • Fixed footer size for notebook screen (bace90808)
  • Fixed notebook-sheet position and flicker (fe7c7e8db)
  • Fixed selection header (716239abf)
  • Fixed vault unlock with biometrics (62dd5a541)
  • Fixed search bar position on iOS (96558c5df)
  • Fixed confusing settings/sync button (95b511407)
  • Fixed back navigation from editor (20742e2a1)
  • Fixed opening internal link in readonly mode (d77c09f1f)
  • Fixed position of context menu (aa602ea8e)
  • Fixed sidebar order not loading on app launch (404d136a7)
  • Fixed placeholder showing always in first line of editor (cf9aeecd7)
  • Fixed many papercut UX issues in search replace (1adda96ce)
  • Fixed middle pane size increasing on exiting focus mode (b8c68b516)
  • Fixed position of image preview toolbar (249600489)
  • Fixed navigation menu resize issues (781d09dac)
  • Fixed toggles in properties not working (2ea9b0486)
  • Fixed database disk image is malformed error on updating deleted content (5dbabc270)
  • Fixed various editor crashes (d85974ed7)
  • Fixed wrong version in update sheet (9598ea754)
  • Fixed multi-selection UX (42048ad53)
  • Fixed crash during backup (1fbd2efb9)
#notesnook#releases
Abdullah Atta
Abdullah AttaLead developer of Notesnook
PREV POSTNotesnook v3.0.2NEXT POST Introducing Notesnook v3