-
Notifications
You must be signed in to change notification settings - Fork 29
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 render page with angular12 universal (SSR) #59
base: master
Are you sure you want to change the base?
Conversation
Does Zone.js just replace the globals or monkey-patch the Node.js modules as well? I mean: could we just add const {setTimeout, setInterval} = require('timers'); at the beginning? |
yes, timers monky-patched by zone.js, and needed for working ChangeDetection mechanism of angular. |
It seems that it just works with import 'zone.js';
Zone.current.run(() => {
setTimeout(() => {
console.log('foobar');
}, 1000).unref();
});
// Uncomment this and foobar will be logged:
// setTimeout(() => {}, 1100); |
I just tested import 'zone.js';
import CacheableLookup from 'cacheable-lookup';
const cacheable = new CacheableLookup();
Zone.current.run(() => {
cacheable.lookup('google.com', console.log);
}); and it exists right away. Are you sure it is |
i prepare repo for reproducing case and hope you can help me find the right solution https://github.com/a-shpota/cacheable-reproduce
in console print pending makrotasks with trace entrypoint |
I got
when running |
no, sorry. We used cacheable proxy. Fixes pushed |
cb21fa9
to
08a6478
Compare
Problem:
Has problem on use package with Zone.js of angular universal.
Server (SSR) don`t render page while there are active ones zone.js macrotask.
Removed using setInterval & setTimeout