Skip to content

Commit

Permalink
Tidy up TODOs
Browse files Browse the repository at this point in the history
  • Loading branch information
SkepticMystic committed Jan 23, 2024
1 parent d86a35a commit 0723984
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 20 deletions.
6 changes: 3 additions & 3 deletions src/components/EdgeLink.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
export let show_node_options: ShowNodeOptions;
export let cls = "";
const dendron_settings = plugin.settings.explicit_edge_sources.dendron_note;
const { dendron_note } = plugin.settings.explicit_edge_sources;
const display = stringify_node(edge.target_id, edge.target_attr, {
show_node_options,
trim_basename_delimiter:
dendron_settings.enabled && dendron_settings.display_trimmed
? dendron_settings.delimiter
dendron_note.enabled && dendron_note.display_trimmed
? dendron_note.delimiter
: undefined,
});
</script>
Expand Down
26 changes: 15 additions & 11 deletions src/components/page_views/PrevNextView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,21 @@
export let plugin: BreadcrumbsPlugin;
const grouped_out_edges = $active_file_store
? group_by(
plugin.graph
.mapOutEdges(
$active_file_store?.path,
objectify_edge_mapper((e) => e),
)
.filter((e) => ["prev", "next"].includes(e.attr.dir)),
(e) => e.attr.dir,
)
: null;
const grouped_out_edges =
$active_file_store &&
// Even tho we ensure the graph is built before the views are registered,
// Existing views still try render before the graph is built.
plugin.graph.hasNode($active_file_store.path)
? group_by(
plugin.graph
.mapOutEdges(
$active_file_store.path,
objectify_edge_mapper((e) => e),
)
.filter((e) => ["prev", "next"].includes(e.attr.dir)),
(e) => e.attr.dir,
)
: null;
</script>

<div class="BC-prev-next-view flex">
Expand Down
5 changes: 2 additions & 3 deletions src/external/dataview/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import type BreadcrumbsPlugin from "src/main";
const await_if_enabled = (plugin: BreadcrumbsPlugin) =>
new Promise<void>((resolve) => {
if (is_enabled(plugin.app)) {
// TODO: The docs say the obsidian-dataview lib comes with types... figure that out
if (get_api(plugin.app)?.index.initialized) {
console.log("dataview index already initialized");
resolve();
Expand All @@ -22,8 +21,8 @@ const await_if_enabled = (plugin: BreadcrumbsPlugin) =>
() => {
console.log("dataview:index-ready");
resolve();
}
)
},
),
);
} else {
console.log("dataview not enabled");
Expand Down
2 changes: 1 addition & 1 deletion src/graph/builders/explicit/dendron_note.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const get_dendron_note_info = (

/** Take in the info of a _potential_ dendron note.
* Check that it has the delimeter in it's basename
* Get the field info from the note or default settings (TODO)
* Get the field info from the note or default settings
* Add the directed edge to the target
*/
const handle_dendron_note = (
Expand Down
11 changes: 9 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import { MatrixView } from "src/views/matrix";
import { PROD } from "./const";
import { dataview_plugin } from "./external/dataview";
import { BCGraph } from "./graph/MyMultiGraph";
import { stringify_edge } from "./graph/utils";
import { CreateListIndexModal } from "./modals/CreateListIndexModal";
import { migrate_old_settings } from "./settings/migration";
import { deep_merge_objects } from "./utils/objects";
import { redraw_page_views } from "./views/page";
import { stringify_edge } from "./graph/utils";

export default class BreadcrumbsPlugin extends Plugin {
settings!: BreadcrumbsSettings;
Expand Down Expand Up @@ -169,7 +169,14 @@ export default class BreadcrumbsPlugin extends Plugin {
active_file_store?: false;
redraw_page_views?: false;
}) {
console.log("bc.refresh");
console.log(
"bc.refresh",
["rebuild_graph", "active_file_store", "redraw_page_views"]
.filter(
(key) => options?.[key as keyof typeof options] !== false,
)
.join(", "),
);

// Rebuild the graph
if (options?.rebuild_graph !== false) {
Expand Down

0 comments on commit 0723984

Please sign in to comment.