Open yoshinorin opened 6 months ago
git clone -b perf/router-refresh https://github.com/hexojs/hexo.git
cd hexo
npm install
npm test
The test cases for the watcher are failing.
Now green. Use unique files for each test for watch. Because using the same files (test.txt
) as other tests caused failures. Perhaps caused by caching or something similar, but I'm not sure.
Totals | |
---|---|
Change from base Build 8800035659: | 0.0% |
Covered Lines: | 9297 |
Relevant Lines: | 9393 |
I've noticed that when db.json
exists before hexo s
execution, CSS files and others aren't registered to the route in this PR. This is likely related to the tests failing when the file test.txt
is used. I'll investigate.
I've noticed that when db.json exists before hexo s execution, CSS files and others aren't registered to the route in this PR. This is likely related to the tests failing when the file test.txt is used. I'll investigate.
It seems that the _routerRefresh
method is called not only for updating the router
but also for initializing the router
. Therefore, it seems necessary to make changes such as separating the method for initialization and updating.
What does it do?
When any file is modified, even unchanged routes are updated (the
set
method is called). Additionally, in theset
method, EventEmitter's emit is called. So, events to be fired many times (number of assets) whenever a single file is updated.Maybe, it should be fine to call the
set
method only for the modified files.Screenshots
N/A
Pull request tasks