Skip to content

Commit

Permalink
fix(TreeView): 🐛 Fail silently if mainG is not ready yet
Browse files Browse the repository at this point in the history
  • Loading branch information
SkepticMystic committed Jan 11, 2022
1 parent c150cb9 commit a2b19a1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -22306,7 +22306,7 @@ function removeUnlinkedNodes(g) {
*/
function getSubInDirs(main, ...dirs) {
const sub = new graphology_umd_min.MultiGraph();
main.forEachEdge((k, a, s, t) => {
main === null || main === void 0 ? void 0 : main.forEachEdge((k, a, s, t) => {
if (dirs.includes(a.dir)) {
//@ts-ignore
addNodesIfNot(sub, [s, t], a);
Expand Down Expand Up @@ -52826,6 +52826,11 @@ class BCPlugin extends require$$0.Plugin {
await this.drawTrail();
this.registerActiveLeafChangeEvent();
this.registerLayoutChangeEvent();
this.app.workspace.iterateAllLeaves((leaf) => {
if (leaf instanceof require$$0.MarkdownView) {
leaf.view.previewMode.rerender(true);
}
});
});
for (const { type, plain, constructor } of this.VIEWS) {
this.addCommand({
Expand Down Expand Up @@ -53068,8 +53073,7 @@ class BCPlugin extends require$$0.Plugin {
el.innerHTML = err;
return;
}
const { dir, fields, type, title, depth, flat } = parsedSource;
switch (type) {
switch (parsedSource.type) {
case "tree":
new CBTree({
target: el,
Expand Down
2 changes: 1 addition & 1 deletion src/graphUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export function removeUnlinkedNodes(g: MultiGraph) {
*/
export function getSubInDirs(main: MultiGraph, ...dirs: Directions[]) {
const sub = new MultiGraph();
main.forEachEdge((k, a, s, t) => {
main?.forEachEdge((k, a, s, t) => {
if (dirs.includes(a.dir)) {
//@ts-ignore
addNodesIfNot(sub, [s, t], a);
Expand Down

0 comments on commit a2b19a1

Please sign in to comment.