org-roam / org-roam-server

A Web Application to Visualize the Org-Roam Database
MIT License
635 stars 51 forks source link

Reload Page Automatically #144

Open SidharthArya opened 3 years ago

SidharthArya commented 3 years ago

I am using this code to change the filters in the org roam server. But the change is not being reflected in the page right away. It needs to be explicitely reloaded. Is there a way to update the filter automatically in the page, or reload the page as soon as the update is made.

(setq org-roam-server-tags "")
(defun my-org-roam-server-tags()
  "Process org-roam-server-tags"
  (interactive)
  (let* (
         (tags (read-string "Tags: " org-roam-server-tags))
         (tags-temp (cdr (split-string tags "\ [\+]")))
         (plus (mapcar (lambda(a) (string-trim (car (split-string a "\ [\-]")))) tags-temp))
         (tags-temp (cdr (split-string tags "\ [\-]")))
         (minus (mapcar (lambda(a) (string-trim (car (split-string a "\ [\+]")))) tags-temp)))

    (setq org-roam-server-default-include-filters (json-encode (mapcar (lambda (tag) (list (cons 'id tag ) (cons 'parent "tags"))) plus)))
    (setq org-roam-server-default-exclude-filters (json-encode (mapcar (lambda (tag) (list (cons 'id tag ) (cons 'parent "tags"))) minus)))
    (setq org-roam-server-tags tags)
         ))
goktug97 commented 3 years ago

Unfortunately, the filters are only loaded at the beginning. See https://github.com/org-roam/org-roam-server/blob/2122a61e9e9be205355c7e2c1e4b65986d6985a5/index.html#L309-L329