Repository navigation
Run a child component's async callback against that child - #705
Open
cmcmanus96 wants to merge 1 commit into
Open
cmcmanus96 wants to merge 1 commit into
cmcmanus96 wants to merge 1 commit into
Conversation
A finished() or failed() closure written inside a child component was rebound to the screen when the result arrived, so $this->result = ... wrote to the screen and the child never saw its result. The closure now keeps the child as $this while the child is still mounted on the screen. If the child has unmounted, or a new instance has replaced it under the same key, the result is dropped, as a scoped task already is once its screen is no longer topmost. Closures written outside a component are still bound to the screen.
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A
finished()orfailed()closure written inside a child component runs against the screen instead of the child. So$this->result = $resultsets a property on the screen, and the child that started the task never sees its result.What changes
handleAsyncCompletion()now looks at the object the closure was written in.$this.What to watch for
A callback that worked around this by writing to the screen from inside a child will now write to the child. I don't know of any code that relies on that, and it reads as a bug where it does.
Testing
Two new tests in
AsyncTaskCompletionTest:finished()callback sets the child's property and leaves the screen's alone.Both fail on
mainand pass with the change. The full suite passes, except the sixAppStoreConnectBuildNumberLookupTesttests, which fail onmaintoo on my machine (OpenSSL refuses to generate the test key). Pint is clean.Found in the /dev/null app (NativePHP/dev-null-app#172), where it ships as a Composer patch until this lands.