Matt Tracy be7e37e924 Retain block references on file reload
Commit fixes a bug where block references (i.e. `:block/refs`
association in the db) are lost when the page containing the referenced
block is re-loaded due to an update of its underlying file.

Description of Bug:

The bug occurs because when a file is re-loaded to the DB from disk, all existing blocks
belonging to the file are deleted via `retractEntity`, and then blocks
from the parsed file are added. If the file had only had small changes,
the new block set will be very similar to the previous one, although
with different db/ids.

However, while new blocks with "id:: " properties will assume the UUID value
of the previous version of the block, any references to that block via
UUID will *not* be restored in the DB; they are deleted with the
retractEntity command. This results in an inconsistent DB state, where references that should
exist do not.

Description of Fix:

The 'delete-blocks-fn' passed to the graph_parser has been modified as
such:

- It now accepts a list of block uuids to *retain*; graph parser will
  pass the blocks parsed from the new file content.
- For any blocks which match a UUID in the retain list, instead of
  deleting via retractEntity, the individual attributes are deleted via
  retractAttribute (the `retract-attributes` from schema.cljs is used
  for this purpose).
2022-11-16 14:05:19 -08:00
2022-11-11 20:43:37 +08:00
2022-11-11 20:43:37 +08:00
2022-11-16 12:26:58 +08:00
2021-03-16 23:03:46 +08:00
2022-07-06 13:51:46 +08:00
2022-05-18 18:29:54 +08:00
2022-11-16 13:25:55 +08:00
2022-07-06 13:51:46 +08:00
2022-11-16 13:25:55 +08:00

Logseq

latest release version License Twitter follow forum discord total

Contributors Contributors

A local-first, non-linear, outliner notebook for organizing and sharing your personal knowledge base.

Use it to organize your todo list, to write your journals, or to record your unique life.

Logseq - Your joyful, private digital garden | Product Hunt

Download our free Desktop app

Sponsor our contributors on Open Collective, Logseq will move to Stripe later!

Why Logseq?

Logseq is a platform for knowledge management and collaboration. It focuses on privacy, longevity, and user control.

The server will never store or analyze your private notes. Your data are plain text files and we currently support both Markdown and Emacs Org mode (more to be added soon).

In the unlikely event that the website is down or cannot be maintained, your data is, and will always be yours.

Image of logseq

Sponsors

Our top sponsors are shown below! [Become a sponsor]

Plugins documentation (Draft)

The plugins documentation is at https://logseq.github.io/plugins. Any feedback would be greatly appreciated!

Feature requests

Please go to https://discuss.logseq.com/c/feature-requests/7.

How can I use it?

  1. Download the desktop app at https://github.com/logseq/logseq/releases.
  2. Start writing and have fun!

FAQ

Please go to https://docs.logseq.com/#/page/faq.

Credits

Logseq is hugely inspired by Roam Research, Org Mode, Tiddlywiki, Workflowy and Cuekeeper, hats off to all of them!

Logseq is also made possible by the following projects:

Logseq Credits

Learn more


The following is for developers and designers who want to build and run Logseq locally and contribute to this project.

We have a dedicated overview page for Logseq's codebase overview and a development practices page.

Set up development environment

There are more guides in docs/, e.g. the Guide for contributing to translations and the Docker web app guide

Thanks

JetBrains

Languages
Clojure 78.4%
JavaScript 7.9%
CSS 4.5%
TypeScript 3.7%
Swift 2%
Other 3.4%