03:10 | <Steve Hicks> | I think we can extend this as well. Imagine the parent is doing a fetch and creates an abort signal, then passes that same signal to the children to perform their fetches. They each setup their own fetch state otherwise, maybe logging. It’d be surprising that the parent aborting their fetch causes the child’s fetch to inherit the parent’s fetch state. |
03:13 | <Justin Ridgewell> | I expect the children to abort, not for the cleanup code in the children to assume the signaling event’s context. |
03:15 | <Steve Hicks> | Gotcha, I think I misunderstood "sets up their own fetch state". You were saying that they might add some of their own async vars as well, and that it should be encapsulated to the child rather than flowing through from the parent. I agree. |
03:16 | <Justin Ridgewell> | Yes, rereading it now I didn’t word it well. |
04:29 | <Steve Hicks> | Another example where encapsulated (defualt flow-around) approach makes sense is to behave like React's In general, this use case of "implicit parameter propagation without needing to virally change the signatures in between" is relevant both in JSX but also in ordinary JS, and it basically always wants the bind-around approach. |
09:27 | <Jia Li> | Hello, I am Jia Li, the maintainer of the Zone.js, thank you for having me here. |
12:49 | <littledan> | Hello, I am Jia Li, the maintainer of the Zone.js, thank you for having me here. |
12:53 | <littledan> | One particular example we have been thinking about is, what zone should an event run in, when it is triggered by JS? I guess Zone.js runs it in the zone where the event was registered, but we are thinking about running it in the zone which triggered the event. |
13:46 | <Jia Li> | littledan:
|
13:47 | <littledan> | Jia Li: What kind of feedback have you gotten over time about this policy? Do people ever complain that it gives them the wrong results? |
13:56 | <Jia Li> | About eventTask, some people asks the question why the zone is not the zone when the event triggered which is confuse in some cases, but in Angular, event task basically always run in the same zone, so there are no big difference about using the register zone or the trigger zone(they are the same in the 99% of the use cases). And I think the event trigger such as |
14:29 | <Stephen Belanger> | The exit is the end of the scope function. It applies scopes in exactly the same way. It just does it implicitly at the runtime level. And yes, there most certainly is a way to know when execution ends: any time the runtime would become idle and/or transition to microtask processing it knows it has reached the end of the current selection of synchronous code. At that point you end that context. However, you don't actually need to know when an end occurs if all execution descends from a root at the beginning of execution as then the start of any execution would be propagating and therefore swapping out the context value anyway, so clearing it at the end actually becomes unnecessary as it would be immediately followed by a change anyway. There's actually been mathematical proofs of this for the .NET implementation. |
14:38 | <littledan> |
|
14:39 | <littledan> | Even for clicking, sometimes you dispatchEvent, but usually you actually just click, in which case you don't have anything to go on besides the registration zone |
14:40 | <littledan> | so maybe the "triggering zone" should be used when it exists, otherwise you fall back to the registration-time zone |
19:22 | <Justin Ridgewell> |
The exit is the end of the scope function Which means there’s a leak until the end of the function. https://gist.github.com/jridgewell/4aa2d6458f41d4574d6aeb580dc80d5d |
19:24 | <Justin Ridgewell> | And yes, there most certainly is a way to know when execution ends: any time the runtime would become idle and/or transition to microtask processing it knows it has reached the end of the current selection of synchronous code. How do you propose expsoing this API to libraries? |
20:01 | <Justin Ridgewell> | However, you don't actually need to know when an end occurs if all execution descends from a root at the beginning of execution as then the start of any execution would be propagating and therefore swapping out the context value anyway This doesn’t fully remove the need for the above end of task detection, becuase the last object placed there can’t be freed until the event loops replaces the context. It also means that Jobs would place an empty context when they return, which is OK I guess. |
23:24 | <Jia Li> | so maybe the "triggering zone" should be used when it exists, otherwise you fall back to the registration-time zone So there are two cases.
I still belive the current policy (run callback in the register zone) make more senses, and maybe in some cases let use can also access both the register zone and the trigger zone will be better. |
23:41 | <Justin Ridgewell> | zone.js unified policy perspective Is this documented somewhere? |