Skip to content

Async afterEach hook breaks ready and doneEach hooks #449

Closed
@imyelo

Description

@imyelo

Async afterEach hooks such as:

$docsify.plugins = [].concat(install, $docsify.plugins)

function install (hook, vm) {
  hook.afterEach(function (html, next) {
    setTimeout(function () {
      next(html)
    }, 1000)
  })
}

breaking doneEach events dependent plugins, such as zoom-image.

Demo:
https://docsify-pagination-issue-1-nzhdhlzryc.now.sh/#/
Source of demo:
https://docsify-pagination-issue-1-nzhdhlzryc.now.sh/_src

(Came from imyelo/docsify-pagination#1)

I guess the next function in this place should run after callback:
https://github.com/QingWei-Li/docsify/blob/e5a263f1bb0909e1629abf76e327f7f2b50340d8/src/core/render/index.js#L149

For the current version, however, if callback is an asynchronous function, this assumption will be broken.

Metadata

Metadata

Assignees

Labels

bugconfirmed as a bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions