This commit is contained in:
Tom Moor
2018-07-01 09:16:38 -07:00
parent 7780efce0e
commit 899b637979
8 changed files with 295 additions and 157 deletions

View File

@@ -8,7 +8,7 @@ import UiStore from 'stores/UiStore';
import parseTitle from '../../shared/utils/parseTitle';
import unescape from '../../shared/utils/unescape';
import type { User } from 'types';
import type { NavigationNode, User } from 'types';
import BaseModel from './BaseModel';
import Collection from './Collection';
@@ -52,17 +52,11 @@ class Document extends BaseModel {
}
@computed
get pathToDocument(): Array<{ id: string, title: string }> {
get pathToDocument(): NavigationNode[] {
let path;
const traveler = (nodes, previousPath) => {
nodes.forEach(childNode => {
const newPath = [
...previousPath,
{
id: childNode.id,
title: childNode.title,
},
];
const newPath = [...previousPath, childNode];
if (childNode.id === this.id) {
path = newPath;
return;