mirror of
https://github.com/lllin000/PaperForge.git
synced 2026-07-22 06:50:53 +00:00
fix(dashboard): fix discussion card rendering after sync read migration
- Replace leftover .catch() from old Promise chain with proper try/catch - Use fs.readFileSync for reliable file access in Obsidian plugin context
This commit is contained in:
parent
806292febb
commit
fd47d52c13
1 changed files with 8 additions and 3 deletions
|
|
@ -1532,7 +1532,12 @@ class PaperForgeStatusView extends ItemView {
|
|||
const wsDir = lastSlash !== -1 ? entry.note_path.substring(0, lastSlash) : '.';
|
||||
const discPath = wsDir + '/ai/discussion.json';
|
||||
|
||||
this.app.vault.adapter.read(discPath).then((raw) => {
|
||||
const vp = this.app.vault.adapter.basePath;
|
||||
const absPath = path.join(vp, discPath);
|
||||
|
||||
try {
|
||||
if (!fs.existsSync(absPath)) return;
|
||||
const raw = fs.readFileSync(absPath, 'utf-8');
|
||||
const data = JSON.parse(raw);
|
||||
if (!data.sessions || data.sessions.length === 0) return;
|
||||
|
||||
|
|
@ -1577,9 +1582,9 @@ class PaperForgeStatusView extends ItemView {
|
|||
new Notice('讨论文件尚未生成');
|
||||
}
|
||||
});
|
||||
}).catch(() => {
|
||||
} catch (e) {
|
||||
// No discussion.json — card stays hidden
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/* ── Paper Files Row ── */
|
||||
|
|
|
|||
Loading…
Reference in a new issue