Mossy1022 / Smart-Connections-Visualizer

Visualize your notes and see links to related content with AI embeddings. Use local models or 100+ via APIs like Claude, Gemini, ChatGPT & Llama 3
MIT License
40 stars 4 forks source link

[SOLUTION] "No nodes or links to display after filtering. Adjust filter settings" on any setting #13

Open schmidtzoltan opened 3 weeks ago

schmidtzoltan commented 3 weeks ago

So just like most everybody using this plugin, I ran into an issue with the Visualizer. Not sure how long this issue persists, but regardless of filter settings, the "No nodes or links to display after filtering. Adjust filter settings" message appears.

As earlier Issues were stating it used to work, I wanted to see myself what's going on here and I found the source of the bug: method addFilteredConnections doesn't do anything and doesn't notify about it:

image

A forEach callback is executed on the list of relevant SmartBlocks (and SmartSources, or whatever they are called that fails silently if each item lack either a data property, or a key property in that data; and it seems at least the recent Smart Connections version does not provide a key anymore. Not sure how long it's been like that though.

My solution was to set key to the value of the already existing and seemingly always unique path property:

  addFilteredConnections(noteConnections) {
    const filteredConnections = noteConnections.filter((connection) => {
      if (this.connectionType === "both") {
        return true;
      } else {
        return this.connectionType === "block" === connection instanceof this.env.item_types.SmartBlock;
      }
    });
    filteredConnections.forEach((connection, index2) => {
      // this condition is what I added
      if (!connection.data.key) {
        connection.data.key = connection.data.path
      }

      if (connection && connection.data && connection.data.key) {
        const connectionId = connection.data.key;
        this.addConnectionNode(connection);
        this.addConnectionLink(connectionId, connection);
      } else {
      }
    });
  }

This fixed the vizualizer flawlessly and immediately, but I'm not sure it's a "clean enough" solution; merely a hack, or patch, or whatever you call it.

@Mossy1022 I think you should address this issue by some means, though I can't help any better than this. As of today, SmartBlocks have no unique identifiers other than ˛data.path, sadly.

Also I checked only the compiled JS; the error in the TypeScript content is supposed to be here.

Hope this helps!

brianpetro commented 3 weeks ago

@schmidtzoltan data.key was removed because it was the same as data.path.

Also, instead of item.data.key, you can simply use item.key (or based on the code connection.key) 🌴

Mossy1022 commented 2 weeks ago

Thanks @schmidtzoltan for delving in! This app depends upon Smart Connections, so when there's changes in that app– this doesn't update automatically for breaking changes. We're workin on a way to better the response time to update when that happens.

I'll update the code to use connection.key. Thanks @brianpetro! for the extra info.

Update to v 1.0.17 and let me know if that resolves your issue.

aaronVerones commented 2 weeks ago

Hey @Mossy1022, I also had this issue and submitted a PR before I saw this conversation. Thanks for getting it resolved. Though, I updated to 1.0.17 and it looks like the issue still exists. Have you updated the code yet?

unknownterritory commented 2 weeks ago

The issue persists.

Mossy1022 commented 1 week ago

@unknownterritory @aaronVerones Can you guys let me know if it still exists? I went ahead and approved your PR @aaronVerones just in case as it seems it was working for you. I'm not getting any errors.

As a note, I noticed the view would not work if you had multiple of the same view open, so I just made an update to toggle to an existing SC Visualizer view if it's there, rather than opening a new one.

And thanks for your patience! I just came back from a vacation.

Please update to v1.0.18.