Skip to content

Commit

Permalink
fix: 🐛 Checks for new note
Browse files Browse the repository at this point in the history
  • Loading branch information
SkepticMystic committed Jan 29, 2022
1 parent 49fa7ab commit 63f062e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
1 change: 0 additions & 1 deletion src/Settings/HierarchyNoteSettings.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Notice, Setting } from "obsidian";
import { isInVault } from "obsidian-community-lib/dist/utils";
import type BCPlugin from "../main";
import { splitAndTrim } from "../Utils/generalUtils";
import { getFields } from "../Utils/HierUtils";
Expand Down
3 changes: 2 additions & 1 deletion src/Views/MatrixView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ export default class MatrixView extends ItemView {
if (!mainG) return [];

const { basename } = currFile;
if (!mainG.hasNode(basename)) return [];
const realsnImplieds = this.getMatrixNeighbours(plugin, basename);

return userHiers.map((hier) => {
Expand Down Expand Up @@ -299,7 +300,7 @@ export default class MatrixView extends ItemView {
const { contentEl, db, plugin } = this;
db.start2G("Draw Matrix/List View");
contentEl.empty();
const { settings } = plugin;
const { settings, mainG } = plugin;
const { userHiers } = settings;
const currFile = this.app.workspace.getActiveFile();
if (!currFile) return;
Expand Down
10 changes: 7 additions & 3 deletions src/Views/TrailView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function getNextNPrev(plugin: BCPlugin, currNode: string) {

export async function drawTrail(plugin: BCPlugin): Promise<void> {
try {
const { settings, db, app } = plugin;
const { settings, db, app, mainG } = plugin;
const {
showBCs,
noPathMessage,
Expand Down Expand Up @@ -138,6 +138,12 @@ export async function drawTrail(plugin: BCPlugin): Promise<void> {
return;
}

const { basename } = file;
if (!mainG.hasNode(basename)) {
db.end2G();
return;
}

const view =
mode === "preview"
? activeMDView.previewMode.containerEl.querySelector(
Expand All @@ -153,8 +159,6 @@ export async function drawTrail(plugin: BCPlugin): Promise<void> {
const sortedTrails = getBreadcrumbs(settings, closedUp, file);
info({ sortedTrails });

const { basename } = file;

const {
next: { reals: rNext, implieds: iNext },
prev: { reals: rPrev, implieds: iPrev },
Expand Down

0 comments on commit 63f062e

Please sign in to comment.