SkepticMystic / graph-analysis

Analyse the structure of your Obsidian graph using various analysis techniques
GNU General Public License v3.0
400 stars 19 forks source link

Feature request: refresh when the document changes #5

Closed channingwalton closed 2 years ago

channingwalton commented 2 years ago

It would be useful to have the graph-analysis view refresh when the document focus changes.

SkepticMystic commented 2 years ago

@channingwalton doesn't it do this already? I know that the Centrality measure doesn't update when changing note (because it doesn't depend on the current note), but all other measures should change when changing note

channingwalton commented 2 years ago

Its not refreshing for me but perhaps I have some other plugin interfering. I'll try it on a new vault …

channingwalton commented 2 years ago

On a new vault it doesn't update for me. I created two notes, switched between them with the Graph Analysis view open, but it didn't change when the note change.

I am using v0.12.6

The logs are showing this error:

Uncaught TypeError: Cannot read property 'length' of undefined
    at JaccardSimilarity (eval at <anonymous> (app.js:1), <anonymous>:7475:42)
    at eval (eval at <anonymous> (app.js:1), <anonymous>:7481:40)
    at Array.forEach (<anonymous>)
    at similarityForAll (eval at <anonymous> (app.js:1), <anonymous>:7480:11)
    at Object.$$self.$$.update (eval at <anonymous> (app.js:1), <anonymous>:7871:37)
    at init (eval at <anonymous> (app.js:1), <anonymous>:6476:8)
    at new Similarity (eval at <anonymous> (app.js:1), <anonymous>:7903:3)
    at drawComponent (eval at <anonymous> (app.js:1), <anonymous>:7973:25)
    at HTMLSelectElement.eval (eval at <anonymous> (app.js:1), <anonymous>:7981:17)

But I don't think that was related to changes docs, I don't see any logging when the doc changes.

SkepticMystic commented 2 years ago

@channingwalton there has been quite a big refactoring of the code for GA. Can you try out the latest version and let me know if you still experience this bug

channingwalton commented 2 years ago

Looks like its working 👍🏼

SkepticMystic commented 2 years ago

Awesome :)

phlind commented 2 years ago

First of all, thanks for the cool plugin! For me the problem of not auto-updating still is there, at least after some time of using the plugin. Here is an error the console shows (I think it stopped working when I switched to "link prediction"):

LinkPrediction.svelte:62 Uncaught ReferenceError: predictionArr is not defined
    at eval (eval at <anonymous> (app.js:1), <anonymous>:1704:36)
    at run (eval at <anonymous> (app.js:1), <anonymous>:67:12)
    at Array.map (<anonymous>)
    at eval (eval at <anonymous> (app.js:1), <anonymous>:337:45)
    at flush (eval at <anonymous> (app.js:1), <anonymous>:201:17)
    at init (eval at <anonymous> (app.js:1), <anonymous>:425:9)
    at new LinkPrediction (eval at <anonymous> (app.js:1), <anonymous>:1785:3)
    at drawComponent (eval at <anonymous> (app.js:1), <anonymous>:2404:25)
    at HTMLSelectElement.eval (eval at <anonymous> (app.js:1), <anonymous>:2415:17)
SkepticMystic commented 2 years ago

Hey phlind, thanks for the bug report. I'm actually working on the plugin, atm, and just caught that bug by coincidence! Should be fixed in the next update

phlind commented 2 years ago

Cool, thanks!

SkepticMystic commented 2 years ago

I don't know if it will fix your issue, but it will definitely stop that error from breaking everything else

SkepticMystic commented 2 years ago

@phlind alright, 0.0.27 should be much more improved, in general

phlind commented 2 years ago

Yes, just from a quick test the auto-update seems to work now! 👍

SkepticMystic commented 2 years ago

@phlind 0.0.28 now has a refresh index button, too. Similar to what Breadcrumbs' one does. So if you add or remove links, click that button to have those changes reflected