[Fiber] Always push context before bailouts#1
[Fiber] Always push context before bailouts#1gaearon wants to merge 2 commits intobvaughn:unexpected-context-popfrom
Conversation
When I first wrote the context code, I didn't fully understand how bailouts work. Even if a fiber bails out, it still has to complete. Therefore we should always push the context even if we later bail out.
|
This looks much nicer, having things grouped into a single function like that. It looks like we're maybe pushing too frequently now though. For example, given a Seems like an oversight? |
|
This is the downside of colocating begin with other begins and complete with other completes instead of the type of work. Pattern matching vs. OO. :) |
Good catch. Can we just remove those remaining Could you add corresponding tests that are failing with this PR, and cherry-pick my fix (or equivalent) and then fix up those remaining cases? |
I think so. Yeah, that seems like a better way to go.
Yeah. This will likely take me a while though so I'll probably do it on Monday or over the weekend (not tonight). Catching these cases in tests is a little tricky for me still. 😄 |
|
There are a couple more issues here. |
* Remove PooledClass from FallbackCompositionState The only module that uses FallbackCompositonState is BeforeInputEventPlugin. The way its structured means there can only be a single instance of FallbackCompositionState at any given time (stored in a local variable at the top-level) so we don't really need pooling here at all. Instead, a single object is now stored in FallbackCompositionState, and access (initializing, reseting, getting data) is gaurded by the exported helper object. * Use new FallbackCompositionState API in BeforeInputEventPlugin * Implement event-specific pooling in SyntheticEvent * Remove PooledClass from TopLevelCallbackBookKeeping * Update results.json * Add pooled event test fixtures (#1) * Fix fixture lint
When I first wrote the context code, I didn't fully understand how bailouts work. Even if a fiber bails out, it still has to complete. Therefore we should always push the context even if we later bail out.