[BUGFIX release] Avoid creating event dispatcher in FastBoot with Engines #15695
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.
Prior to this commit, the
event_dispatcher:main
was always being instantiated so that it can be injected eagerly into child engines. In general, this is good (we should only ever have a single event dispatcher going) but in the FastBoot case the event dispatcher should not have been created at all (since there is no DOM or interactivity booting the event dispatcher to listen to DOM events is wasteful and error prone).This commit updates the EventDispatcher base class to properly look for the
isInteractive
flag (which is what it should have been doing all along) on the-environment:main
that is injected from theApplication.visit
API. WhenisInteractive
is falsey and the event dispatcher is instantiated we will issue an assertion.We also avoid eagerly looking up (and therefore forcing to initialize) the EventDispatcher if
.visit
API is passedisInteractive: false
. This avoids the specifically reported issue of triggering an assertion in FastBoot mode.Fixes #15615