Bloks apply frame and then augment
Summary: Given that we have to retry aggressively to fetch reduciton traces the blok augmentation can take a longer time. For cases like embedded bloks this can slow down the ui debugger even if you arent debuggin bloks. To avoid this we display the frame immediatley and then asynchronously augment it. There is a possibility that you might see bloks bound tree nodes with no name briefly since this is this the state they come from the client as. This isnt the ideal solution as the better way would be to do the unminification first and then add the derived components (which depends on reduction trace) after. This avoid this qurik but is a much bigger refactor so will do it another time if needed Reviewed By: lblasa Differential Revision: D48600897 fbshipit-source-id: 06fc5c5ecc6fe575f815d3ebca685f363275c84c
This commit is contained in:
committed by
Facebook GitHub Bot
parent
3fcb932f28
commit
9ae632ba5c
@@ -210,10 +210,18 @@ export function plugin(client: PluginClient<Events>) {
|
||||
|
||||
const processFrame = async (frameScan: FrameScanEvent) => {
|
||||
try {
|
||||
const nodes = new Map(
|
||||
frameScan.nodes.map((node) => [node.id, {...node}]),
|
||||
);
|
||||
if (frameScan.frameTime > lastFrameTime) {
|
||||
applyFrameData(nodes, frameScan.snapshot);
|
||||
lastFrameTime = frameScan.frameTime;
|
||||
}
|
||||
applyFrameworkEvents(frameScan, nodes);
|
||||
lastFrameTime = frameScan.frameTime;
|
||||
|
||||
const [processedNodes, additionalMetadata] =
|
||||
await streamInterceptor.transformNodes(
|
||||
new Map(frameScan.nodes.map((node) => [node.id, {...node}])),
|
||||
);
|
||||
await streamInterceptor.transformNodes(nodes);
|
||||
|
||||
metadata.update((draft) => {
|
||||
for (const metadata of additionalMetadata) {
|
||||
@@ -221,14 +229,10 @@ export function plugin(client: PluginClient<Events>) {
|
||||
}
|
||||
});
|
||||
|
||||
if (frameScan.frameTime > lastFrameTime) {
|
||||
if (frameScan.frameTime >= lastFrameTime) {
|
||||
applyFrameData(processedNodes, frameScan.snapshot);
|
||||
lastFrameTime = frameScan.frameTime;
|
||||
}
|
||||
|
||||
applyFrameworkEvents(frameScan, processedNodes);
|
||||
|
||||
return true;
|
||||
} catch (error) {
|
||||
pendingData.frame = frameScan;
|
||||
handleStreamError('Frame', error);
|
||||
|
||||
Reference in New Issue
Block a user