Skip to content

Commit

Permalink
Don't set lastImportDate when previeing template
Browse files Browse the repository at this point in the history
  • Loading branch information
mgmeyers committed Aug 25, 2023
1 parent d59fea6 commit bc531e5
Showing 1 changed file with 3 additions and 31 deletions.
34 changes: 3 additions & 31 deletions src/DataExplorerView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,17 @@ import {
TFile,
WorkspaceLeaf,
moment,
normalizePath,
} from 'obsidian';
import React from 'react';
import ReactDOM from 'react-dom';
import { JSONTree } from 'react-json-tree';

import {
dataExplorerPrompt,
getATemplatePath,
renderTemplates,
} from './bbt/export';
import { sanitizeFilePath } from './bbt/helpers';
import { PersistExtension, renderTemplate } from './bbt/template.env';
import { PersistExtension } from './bbt/template.env';
import {
getLastExport,
removeStartingSlash,
sanitizeObsidianPath,
} from './bbt/template.helpers';
import ZoteroConnector from './main';
Expand Down Expand Up @@ -124,32 +119,9 @@ function TemplatePreview({
};

const render = async () => {
const sourcePath = getATemplatePath(params);

try {
const renderedPath = await renderTemplate(
sourcePath,
params.exportFormat.outputPathTemplate,
templateData
);

const markdownPath = normalizePath(
sanitizeFilePath(removeStartingSlash(renderedPath))
);

const existingMarkdownFile =
app.vault.getAbstractFileByPath(markdownPath);

let existingMarkdown = '';
let lastImportDate = moment(0);

if (existingMarkdownFile) {
existingMarkdown = await app.vault.cachedRead(
existingMarkdownFile as TFile
);

lastImportDate = getLastExport(existingMarkdown);
}
const existingMarkdown = '';
const lastImportDate = moment(0);

const output = await renderTemplates(
params,
Expand Down

0 comments on commit bc531e5

Please sign in to comment.