Skip to content

Commit

Permalink
code review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jwajgelt committed Feb 19, 2025
1 parent 56fbd7e commit 8591ff1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions packages/vscode-extension/lib/instrumentation.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,15 @@ function onCommitFiberRoot(_rendererID, root) {
onRender(renderedFibers);
}

export const setInstrumentationOptions = (partialOptions) => {
export const updateInstrumentationOptions = (partialOptions) => {
const componentBlocklist = partialOptions.componentBlocklist
? new Set(partialOptions.componentBlocklist)
: options.componentBlocklist;
options = { ...options, componentBlocklist, ...partialOptions };
if (!inited) {
inited = true;
instrument({
onCommitFiberRoot: (rendererID, root) => onCommitFiberRoot(rendererID, root),
onCommitFiberRoot,
});
}
};
10 changes: 5 additions & 5 deletions packages/vscode-extension/lib/wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ const InternalImports = {
get reduxDevtoolsExtensionCompose() {
return require("./plugins/redux-devtools").compose;
},
get setInstrumentationOptions() {
return require("./instrumentation").setInstrumentationOptions;
get updateInstrumentationOptions() {
return require("./instrumentation").updateInstrumentationOptions;
},
};

Expand Down Expand Up @@ -416,7 +416,7 @@ export function AppWrapper({ children, initialProps, fabric }) {
if (!devtoolsAgent) {
return;
}
InternalImports.setInstrumentationOptions({
InternalImports.updateInstrumentationOptions({
reportRenders: (blueprintOutlines) => {
devtoolsAgent._bridge.send("RNIDE_rendersReported", { blueprintOutlines });
},
Expand All @@ -427,9 +427,9 @@ export function AppWrapper({ children, initialProps, fabric }) {
// TODO: get initial options when the app starts
useAgentListener(
devtoolsAgent,
"RNIDE_setInstrumentationOptions",
"RNIDE_updateInstrumentationOptions",
(payload) => {
InternalImports.setInstrumentationOptions(payload);
InternalImports.updateInstrumentationOptions(payload);
},
[]
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class RenderOutlinesPlugin implements ToolPlugin, RenderOutlinesInterface
this.eventEmitter.emit("rendersReported", payload);
}
if (event === "RNIDE_queryInstrumentationOptions") {
this.devtools.send("RNIDE_setInstrumentationOptions", { isEnabled: this.isEnabled });
this.devtools.send("RNIDE_updateInstrumentationOptions", { isEnabled: this.isEnabled });
}
};

Expand All @@ -45,7 +45,7 @@ export class RenderOutlinesPlugin implements ToolPlugin, RenderOutlinesInterface

setEnabled(isEnabled: boolean) {
this.isEnabled = isEnabled;
this.devtools.send("RNIDE_setInstrumentationOptions", { isEnabled });
this.devtools.send("RNIDE_updateInstrumentationOptions", { isEnabled });
}

addEventListener<K extends keyof RenderOutlinesEventMap>(
Expand Down

0 comments on commit 8591ff1

Please sign in to comment.