Skip to content

Commit

Permalink
fix: 🐛 More silent fails if no next/prev yet
Browse files Browse the repository at this point in the history
  • Loading branch information
SkepticMystic committed Nov 18, 2021
1 parent 7ae9a82 commit 489c3c3
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/sharedFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,7 @@ export async function getNeighbourObjArr(
current: TFile;
hierarchies: HierarchyFields[];
}[] = fileFrontmatterArr.map((fileFrontmatter) => {
const currFileName =
fileFrontmatter.file.basename || fileFrontmatter.file.name;
const currNode = fileFrontmatter.file.basename || fileFrontmatter.file.name;
const hierFields: {
current: TFile;
hierarchies: HierarchyFields[];
Expand All @@ -359,7 +358,7 @@ export async function getNeighbourObjArr(
hierarchies: [],
};

userHierarchies.forEach((hier, i) => {
userHierarchies.forEach((hier) => {
const fieldsArr = Object.values(hier) as [string[], string[], string[]];
const newHier: HierarchyFields = {
up: {},
Expand All @@ -372,7 +371,7 @@ export async function getNeighbourObjArr(
// Add regular metadata links
if (settings.useAllMetadata) {
DIRECTIONS.forEach((dir, i) => {
fieldsArr[i].forEach((field) => {
fieldsArr[i]?.forEach((field) => {
newHier[dir][field] = getFieldValues(
fileFrontmatter,
field,
Expand All @@ -384,13 +383,13 @@ export async function getNeighbourObjArr(

// Add Juggl Links
if (jugglLinks.length) {
const jugglLinksInFile = jugglLinks.filter((jugglLink) => {
return jugglLink.note === currFileName;
})[0];
const jugglLinksInFile = jugglLinks.find((jugglLink) => {
return jugglLink.note === currNode;
});

if (jugglLinksInFile) {
jugglLinksInFile.links.forEach((line) => {
if ((hier[line.dir] as string[]).includes(line.type)) {
if ((hier[line.dir] as string[])?.includes(line.type)) {
newHier[line.dir][line.type] = [
...new Set([
...(newHier[line.dir][line.type] ?? []),
Expand Down

0 comments on commit 489c3c3

Please sign in to comment.