Skip to content

[DatacoreJSX] Embedded block inside hover preview reads parent file's frontmatter instead of embedded file's #167

Description

@ichris007

Description

I have a DatacoreJSX dashboard that reads frontmatter from the "active file". I embed this dashboard into candidate files. When I hover over a link to these candidate files from a parent file, the dashboard incorrectly reads the parent file's frontmatter.

File Structure

parent.md                          ← has its own frontmatter
    └── [[candidate.md]]           ← hover preview triggers here
              |
              └── candidate.md     ← has candidate-specific frontmatter
                    └── ![[dashboard.md]]   ← embedded DatacoreJSX

dashboard.md

const targetFile = app.workspace.getActiveFile();
// expects to read candidate.md's frontmatter
// but in hover preview, gets parent.md

candidate.md

---
status: "Interviewing"
talent: "John Doe"
---

![[dashboard.md]]

parent.md:

---
# unrelated frontmatter
---

Check candidate: [[candidate.md]]

Expected Behavior

When I hover over [[candidate.md]] in parent.md, the popup preview should show candidate.md's data (status: "Interviewing", talent: "John Doe").

Actual Behavior

The popup shows parent.md's frontmatter (empty or unrelated data).

Question

How can I make the embedded DatacoreJSX block always read the file that contains the ![[...]] embed, regardless of whether it's being viewed directly, embedded, or hover-previewed?

What I've Tried

Using app.workspace.getActiveFile() – fails in hover preview context

Using dc.useActiveContext() – same issue

Request

Is there an API to get the "embedding file" rather than the "active file"?

Or a way to detect hover preview mode and get the correct file reference?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions