Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Reload Page Automatically #144

Open
SidharthArya opened this issue Apr 2, 2021 · 1 comment
Open

Reload Page Automatically #144

SidharthArya opened this issue Apr 2, 2021 · 1 comment

Comments

@SidharthArya
Copy link

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
Copy link
Member

goktug97 commented Apr 2, 2021

Unfortunately, the filters are only loaded at the beginning.
See

org-roam-server/index.html

Lines 309 to 329 in 2122a61

$.ajax({
async: false,
type: 'GET',
url: `/default-filters?token=${token}`,
success: function(data) {
if (data.include) {
for (let i = 0; i < data.include.length; i++) {
filters[FilterEnum.include]
.add(JSON.stringify(data.include[i]));
defaultIncludeFilters.push(data.include[i].id);
}
}
if (data.exclude) {
for (let i = 0; i < data.exclude.length; i++) {
filters[FilterEnum.exclude]
.add(JSON.stringify(data.exclude[i]));
defaultExcludeFilters.push(data.exclude[i].id);
}
}
}
});

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants