resolveNetworkAddress: Listen for close instead of exit; Fix FailedApp theme#29046
Merged
resolveNetworkAddress: Listen for close instead of exit; Fix FailedApp theme#29046
close instead of exit; Fix FailedApp theme#29046Conversation
close instead of exitclose instead of exit; Fix FailedApp theme
ryanclark
approved these changes
Jul 13, 2023
|
@ravicious See the table below for backport results.
|
This was referenced Jan 19, 2024
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.
We had another instance of a flaky
resolveNetworkAddresstest. We already tried to deal with this in the past (#25249), but we might have as well fixed one or zero problems at that time while there was another lurking under the surface.resolveNetworkAddressreceives a child process. It listens to bothprocess.stdout.on('data')andprocess.on('exit').resolveNetworkAddressresolves when the child process prints a specific string to stdout or rejects with an error if the process exits before printing the string.The problem is that the fake process we use in tests exits almost immediately after printing since there's nothing else to do.
To guarantee that
resolveNetworkAddressprocesses the data listener before the exit listener, we have to listen forcloseinstead ofexitas the docs say):That's the original issue fixed by this PR. However, while testing the fix in dev version of Connect, by doing
os.Exitright before the port is logged and making the app failed to start, I discovered another problem. The error component AKAFailedAppwas not being rendered successfully.Because of the theme changes, the
Cardcomponent, used inFailedApp, now requires a theme to be rendered. I thought the issue was simply thatCard.defaultPropswere incorrect, but after fixing that I discovered that there's a slew of other components which also require a theme or typography but don't have those props set by default.Instead of fixing them one by one, I decided to simply add a static theme provider so that those components can render. I picked the dark theme so that we don't flash people with a white screen in case of an error.