fix render page with angular12 universal (SSR)#59
fix render page with angular12 universal (SSR)#59a-shpota wants to merge 1 commit intoszmarczak:masterfrom
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