Skip to content

Commit

Permalink
Revert "Fix: ready/doneEach order with async afterEach (#1770)"
Browse files Browse the repository at this point in the history
This reverts commit 076d084.
  • Loading branch information
Koooooo-7 authored Oct 26, 2022
1 parent 9339382 commit 8dd9160
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
9 changes: 5 additions & 4 deletions src/core/render/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,15 +321,15 @@ export function Render(Base) {
);
}

this.callHook('afterEach', html, hookData => {
renderMain.call(this, hookData);
next();
});
this.callHook('afterEach', html, hookData =>
renderMain.call(this, hookData)
);
};

if (this.isHTML) {
html = this.result = text;
callback();
next();
} else {
prerenderEmbed(
{
Expand All @@ -339,6 +339,7 @@ export function Render(Base) {
tokens => {
html = this.compiler.compile(tokens);
callback();
next();
}
);
}
Expand Down
15 changes: 8 additions & 7 deletions test/e2e/plugins.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ test.describe('Plugins', () => {
'mounted',
'beforeEach-async',
'beforeEach',
'afterEach-async',
// 'afterEach-async',
'afterEach',
'doneEach',
'ready',
Expand Down Expand Up @@ -41,12 +41,13 @@ test.describe('Plugins', () => {
return markdown;
});

hook.afterEach(function (html, next) {
setTimeout(function () {
console.log('afterEach-async');
next(html);
}, 100);
});
// FIXME: https://github.com/docsifyjs/docsify/issues/449
// hook.afterEach(function (html, next) {
// setTimeout(function () {
// console.log('afterEach-async');
// next(html);
// }, 100);
// });

hook.afterEach(function (html) {
console.log('afterEach');
Expand Down

0 comments on commit 8dd9160

Please sign in to comment.