-
-
Notifications
You must be signed in to change notification settings - Fork 226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(router): do not run CD cycles unnecessary when markdown modules are loaded #557
Conversation
✅ Deploy Preview for analog-app ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for analog-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for analog-blog ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Thanks @arturovt. Will you share how you track the CD cycles? |
Sure. Firstly, I start with patching const tick = ApplicationRef.prototype.tick;
let ticksCalled = 0;
ApplicationRef.prototype.tick = function () {
console.log(`Ticks called: ${ticksCalled++}`);
return tick.call(this);
}; But this would only tell me the number of CDs happening. Then I track asynchronous tasks which are invoked in the Angular zone. I usually just add a console logging to console.log(task);
onEnter(zone); It'is easy to track event tasks since they have a It's always challenging to track microtasks because zone.js intercepts all calls to zone.scheduleMicroTask(source, () => {
try {
const parentPromiseValue = promise[symbolValue]; The See also this code as an example how tasks can be easily tracked: https://ng-guru.io/guide/change-detection-cycles-per-different-async-apis/#tracing-asynchronous-tasks |
…kdown modules are loaded (analogjs#557)
Hey, I've just started experimenting with Analog and counting change detection cycles occurring in different scenarios due to the various asynchronous operations used in different parts of the code. I noticed that rendering a simple page, like
about.md
from the tutorial, causes 8 ticks immediately. This current commit updates the implementation of thetoMarkdownModule
, which loads@analogjs/content
andmarkdownFileFactory
, scheduling tasks in the root zone.