[BUG] hooks run twice unexpectedly #1732
Description
Bug Report
Steps to reproduce
Not sure what the cause is yet, but I've written local playwright tests that verify that doneEach runs twice on initial page load for a particular test (so the case is isolated).
This is unexpected. For most sites/tests, doneEach runs once, but in some rare case it runs twice. I have experienced this before in practice too.
This might possibly explain what I was seeing in #906 with scripts running twice
What is current behaviour
doneEach runs twice on initial render sometimes.
What is the expected behaviour
It should run one time all the time, or twice all the time. Or something similar, but right now there is something that seems inconsistent.
Other relevant information
-
Bug does still occur when all/other plugins are disabled?
-
Your OS: Linux
-
Node.js version: 17
-
npm/yarn version: 8
-
Browser version: Chrome
-
Docsify version: 4.12.2
-
Docsify plugins: Added a plugin in docs/index.html to log, and log happens twice.
Please create a reproducible sandbox
Not sure how yet.
Activity
[-]hook.doneEach runs twice on initial page load sometimes.[/-][+][BUG] hook.doneEach runs twice on initial page load sometimes.[/+]trusktr commentedon Jan 23, 2022
Here are two stack traces, one from each doneEach call, based on commit 9658ed4 with minification disabled, in lib/docsify.min.js:
In this example, one doneEach happens due to the
initFetchprocess, and the other happens due to theinitRouterprocess.[-][BUG] hook.doneEach runs twice on initial page load sometimes.[/-][+][BUG] hooks run twice unexpectedly[/+]trusktr commentedon Jan 26, 2022
This may be an issue that only happens in an e2e test (as I just discovered), although I thought I experienced this before elsewhere.
jhildenbiddle commentedon Jan 30, 2022
Addressed by #1736.