Skip to content

Commit

Permalink
Fix query injector flakiness (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiebrynes7 authored Jan 13, 2021
1 parent d6c58e1 commit 4fb3295
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Removed built-in update checker as Obsidian has one for plugins now!

### 🐛 Bug Fixes

- Fixed an issue where queries didn't resolve on first load.

## [1.6.1] - 2021-01-06

### 🐛 Bug Fixes
Expand Down
7 changes: 4 additions & 3 deletions src/queryInjector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default class QueryInjector {

onNewBlock(el: HTMLElement, ctx: MarkdownPostProcessorContext) {
const node = el.querySelector<HTMLPreElement>(
'pre[class*="language-todoist"]'
'code[class*="language-todoist"]'
);

if (!node) {
Expand Down Expand Up @@ -69,8 +69,9 @@ export default class QueryInjector {
context: query,
});

const root = pendingQuery.node.parentElement;
root.removeChild(pendingQuery.node);
const parent = pendingQuery.node.parentElement;
const root = parent.parentElement;
root.removeChild(parent);

const child = new InjectedQuery(root, (root: HTMLElement) => {
if (query.isOk()) {
Expand Down

0 comments on commit 4fb3295

Please sign in to comment.