org-roam-ui icon indicating copy to clipboard operation
org-roam-ui copied to clipboard

[MINOR] util function for restarting

Open nrvale0 opened this issue 2 years ago • 1 comments

**Have you checked whether this feature is not already on the project board?

yes

Is your feature request related to a problem? Please describe.

I'm working on a package which extends org-roam and provides some prescriptive guidance around Nodes and capture templates. During development -- and eventually ever for end-users who want to try the package without disturbing their exsiting org-roam database -- I would like to be able to change the value of org-roam-directory and have org-roam-ui draw graphs for the alternative database.

There does not appear to be a programmatic way to restart org-roam-ui and its associated websocket to pick up the new value for org-roam-directory.

Describe the solution you'd like

Please add a utility function to allow clean restart/reload of org-roam-ui including resetting the websocket.

Describe alternatives you've considered

I'm new to elisp so if there are other mechanisms for accomplishing the above I'm fine with those too.

nrvale0 avatar Aug 30 '21 17:08 nrvale0

I don't think I can help you very much with that, as org-roam-ui does not use org-roam-directory directly. We use org-roam-db-query, which uses org-roam-db-location, so if you were to update that org-roam-ui should follow suit.

However, afaik org-roam is not really meant to switch between different data-sets quickly, as you would probably have to

  1. Change org-roam-directory
  2. Clear the cache
  3. Change the db-location
  4. Sync the new database with the new nodes
  5. Turn off org-roam-ui-mode and turn it on again, or, call org-roam-ui--send-graphdata (does the same thing)

If you are already doing all that, then it is indeed org-roam-uis fault, but I don't really know how. After the intial load we do update the graphdata incrementally, but the sent graphdata has priority: if it contains new nodes or if it lacks nodes that are currently being displayed in the graph, the graph will accomadate those changes.

The opening or closing of the websocket shouldn't really affect all this (disabling org-roam-ui-mode closes the websocket).

What are you specifically trying to do? As in, which commands are you invoking, and what does org-roam-ui not do?

tefkah avatar Aug 30 '21 18:08 tefkah