Skip observer notifications during performance tracing#55777
Open
emily8rown wants to merge 1 commit intofacebook:mainfrom
Open
Skip observer notifications during performance tracing#55777emily8rown wants to merge 1 commit intofacebook:mainfrom
emily8rown wants to merge 1 commit intofacebook:mainfrom
Conversation
Summary: During performance tracing, LogBoxStateSubscription was causing an unnecessary re-render even though LogBox messages are already dropped. This happened because async work (e.g. symbolication completing) could trigger `handleUpdate()` during a trace, notifying observers and causing `LogBoxStateSubscription` to `setState` and re-render. The fix adds an `isTracing()` guard inside `handleUpdate()`'s `setImmediate` callback so observer notifications are skipped for the entire duration of a trace. When tracing ends, a new `handleUpdate()` call syncs observers with the current (cleared) state. This eliminates a spurious update visible in Marketplace sell items page performance traces. Differential Revision: D94075642
|
@emily8rown has exported this pull request. If you are a Meta employee, you can view the originating Diff in D94075642. |
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.
Summary:
During performance tracing, LogBoxStateSubscription was causing an unnecessary re-render even though LogBox messages are already dropped. This happened because async work (e.g. symbolication completing) could trigger
handleUpdate()during a trace, notifying observers and causingLogBoxStateSubscriptiontosetStateand re-render.The fix adds an
isTracing()guard insidehandleUpdate()'ssetImmediatecallback so observer notifications are skipped for the entire duration of a trace. When tracing ends, a newhandleUpdate()call syncs observers with the current (cleared) state.This eliminates a spurious update visible in Marketplace sell items page performance traces.
Differential Revision: D94075642