Hi everyone,
I’m a long-time Obsidian user but a first-time plugin developer, so please bear with me if this is a rookie mistake. I’m trying to build a very simple plugin for my personal workflow and have hit a wall.
The Goal:
The plugin has one core function I’m calling “Merge Fellas”. It’s supposed to:
- Find all notes in my vault with the tag
#fellas
. - Read a specific data field from the frontmatter of each note.
- Display the combined data in a custom view pane.
The Problem:
The logic to find the notes and read the data works fine. However, when I try to render the results in the custom view, the UI gets stuck in an unlimited refresh loop. The view pane flickers or “shakes” non-stop, and Obsidian becomes sluggish. I’ve nicknamed it the “merge fellas unlimited shake” bug because it’s so frustratingly persistent.
I suspect I’m handling the component’s state or render lifecycle incorrectly. I’m not using React/Svelte, just plain TypeScript and the Obsidian API to manipulate the DOM for now, trying to keep it simple.
Here is a simplified version of my rendering code:
// Inside my custom ItemView class
async onOpen() {
const container = this.containerEl.children[1];
container.empty();
// This is the problematic function
this.renderView(container);
}
renderView(container: HTMLElement) {
// Console log to see what's happening
console.log("Attempting to render view...");
// My logic to get the merged data
const mergedData = this.getMergedFellasData(); // This function works correctly
const contentEl = container.createEl("div");
contentEl.setText(mergedData);
// I have a feeling the mistake is here. Am I causing a loop?
// In my actual code, I had another call here to refresh the view
// thinking it was necessary, something like:
// this.renderView(container); // MISTAKE!
}