Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/react-devtools-extensions/src/backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ function setup(hook: ?DevToolsHook) {
return;
}

const bridge = new Bridge({
const bridge = new Bridge<any, any>({
listen(fn) {
const listener = event => {
const listener = (event: any) => {
if (
event.source !== window ||
!event.data ||
Expand All @@ -42,7 +42,7 @@ function setup(hook: ?DevToolsHook) {
window.removeEventListener('message', listener);
};
},
send(event, payload, transferable) {
send(event: string, payload: any, transferable: any) {
window.postMessage(
{
source: 'react-devtools-bridge',
Expand Down
4 changes: 2 additions & 2 deletions packages/react-devtools-extensions/src/utils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* global chrome */
// /* global chrome */

import type {BrowserTheme} from 'react-devtools-shared/src/devtools/views/DevTools';
// import type {BrowserTheme} from 'react-devtools-shared/src/devtools/views/DevTools';

// REPLAY Our RDT integration is only for Chrome currently
export const IS_EDGE = false; // navigator.userAgent.indexOf('Edg') >= 0;
Expand Down
6 changes: 3 additions & 3 deletions packages/react-devtools-shared/src/backend/agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export default class Agent extends EventEmitter<{

// Notify the frontend if the backend supports the Storage API (e.g. localStorage).
// If not, features like reload-and-profile will not work correctly and must be disabled.
let isBackendStorageAPISupported = false;
const isBackendStorageAPISupported = false;

bridge.send('isBackendStorageAPISupported', isBackendStorageAPISupported);
bridge.send('isSynchronousXHRSupported', isSynchronousXHRSupported());
Expand All @@ -216,11 +216,11 @@ export default class Agent extends EventEmitter<{
inData,
) => {
let rv;
this._bridge = {
this._bridge = ({
send(event, data) {
rv = {event, data};
},
};
}: any);
try {
this[inEvent](inData);
} catch (err) {
Expand Down
6 changes: 5 additions & 1 deletion packages/react-devtools-shared/src/backend/console.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,11 @@ export function registerRenderer(
// currentDispatcherRef gets injected for v16.8+ to support hooks inspection.
// getCurrentFiber gets injected for v16.9+.
if (currentDispatcherRef != null && typeof getCurrentFiber === 'function') {
const {ReactTypeOfWork} = getInternalReactConstants(version);
const {ReactTypeOfWork} = getInternalReactConstants(
version,
// REPLAY Our fork will never run this code anyway, make Flow happy
() => 0,
);

injectedRenderers.set(renderer, {
currentDispatcherRef,
Expand Down
19 changes: 9 additions & 10 deletions packages/react-devtools-shared/src/backend/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ import {
TREE_OPERATION_UPDATE_ERRORS_OR_WARNINGS,
TREE_OPERATION_UPDATE_TREE_BASE_DURATION,
} from '../constants';
import {HooksNode, inspectHooksOfFiber} from 'react-debug-tools';
import {inspectHooksOfFiber} from 'react-debug-tools';
import {
patchConsoleUsingWindowValues,
registerRenderer as registerRendererWithConsole,
Expand Down Expand Up @@ -96,8 +96,7 @@ import is from 'shared/objectIs';
import hasOwnProperty from 'shared/hasOwnProperty';
// REPLAY Not doing any profiling work for the foreseeable future, disable this
// import {createProfilingHooks} from './profilingHooks';

import type {GetTimelineData, ToggleProfilingStatus} from './profilingHooks';
import type {ToggleProfilingStatus} from './profilingHooks';
import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';
import type {
ChangeDescription,
Expand Down Expand Up @@ -736,7 +735,6 @@ export function attach(
} = ReactPriorityLevels;

const {
getLaneLabelMap,
injectProfilingHooks,
overrideHookState,
overrideHookStateDeletePath,
Expand Down Expand Up @@ -772,11 +770,12 @@ export function attach(
};
}

let getTimelineData: null | GetTimelineData = null;
let toggleProfilingStatus: null | ToggleProfilingStatus = null;

const toggleProfilingStatus: null | ToggleProfilingStatus = null;
// REPLAY Not doing any profiling work for the foreseeable future, disable this
/*
let getTimelineData: null | GetTimelineData = null;


if (typeof injectProfilingHooks === 'function') {
const response = createProfilingHooks({
getDisplayNameForFiber,
Expand Down Expand Up @@ -2485,7 +2484,7 @@ export function attach(
if (
mostRecentlyInspectedElement !== null &&
mostRecentlyInspectedElement.id === id &&
fiberRenderered
fiberRendered
) {
// If this Fiber has updated, clear cached inspected data.
// If it is inspected again, it may need to be re-run to obtain updated hooks values.
Expand Down Expand Up @@ -3925,6 +3924,7 @@ export function attach(
prevFiber.memoizedState,
fiber.memoizedState,
);
// eslint-disable-next-line eqeqeq
return indices == null || indices.length == 0 ? [] : indices;
}
return [];
Expand Down Expand Up @@ -4318,7 +4318,7 @@ export function attach(
},
);

let timelineData: null = null;
const timelineData: null = null;

// REPLAY Not doing any profiling work for the foreseeable future, disable this
/*
Expand Down Expand Up @@ -4833,7 +4833,6 @@ export function attach(
setTrackedPath,
shouldFilterFiber,
startProfiling,
shouldFilterFiber,
stopProfiling,
storeAsGlobal,
unpatchConsoleForStrictMode,
Expand Down
8 changes: 4 additions & 4 deletions packages/react-devtools-shared/src/devtools/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ const debug = (methodName: string, ...args: Array<string>) => {
}
};

const LOCAL_STORAGE_COLLAPSE_ROOTS_BY_DEFAULT_KEY =
'React::DevTools::collapseNodesByDefault';
const LOCAL_STORAGE_RECORD_CHANGE_DESCRIPTIONS_KEY =
'React::DevTools::recordChangeDescriptions';
// const LOCAL_STORAGE_COLLAPSE_ROOTS_BY_DEFAULT_KEY =
// 'React::DevTools::collapseNodesByDefault';
// const LOCAL_STORAGE_RECORD_CHANGE_DESCRIPTIONS_KEY =
// 'React::DevTools::recordChangeDescriptions';

type ErrorAndWarningTuples = Array<{id: number, index: number}>;

Expand Down
28 changes: 14 additions & 14 deletions packages/react-devtools-shared/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ import {
TREE_OPERATION_SET_SUBTREE_MODE,
TREE_OPERATION_UPDATE_ERRORS_OR_WARNINGS,
TREE_OPERATION_UPDATE_TREE_BASE_DURATION,
LOCAL_STORAGE_COMPONENT_FILTER_PREFERENCES_KEY,
LOCAL_STORAGE_OPEN_IN_EDITOR_URL,
LOCAL_STORAGE_SHOULD_BREAK_ON_CONSOLE_ERRORS,
LOCAL_STORAGE_SHOULD_APPEND_COMPONENT_STACK_KEY,
LOCAL_STORAGE_SHOW_INLINE_WARNINGS_AND_ERRORS_KEY,
LOCAL_STORAGE_HIDE_CONSOLE_LOGS_IN_STRICT_MODE,
// LOCAL_STORAGE_COMPONENT_FILTER_PREFERENCES_KEY,
// LOCAL_STORAGE_OPEN_IN_EDITOR_URL,
// LOCAL_STORAGE_SHOULD_BREAK_ON_CONSOLE_ERRORS,
// LOCAL_STORAGE_SHOULD_APPEND_COMPONENT_STACK_KEY,
// LOCAL_STORAGE_SHOW_INLINE_WARNINGS_AND_ERRORS_KEY,
// LOCAL_STORAGE_HIDE_CONSOLE_LOGS_IN_STRICT_MODE,
} from './constants';
import {
ComponentFilterElementType,
Expand Down Expand Up @@ -390,14 +390,14 @@ export function filterOutLocationComponentFilters(
return componentFilters.filter(f => f.type !== ComponentFilterLocation);
}

function parseBool(s: ?string): ?boolean {
if (s === 'true') {
return true;
}
if (s === 'false') {
return false;
}
}
// function parseBool(s: ?string): ?boolean {
// if (s === 'true') {
// return true;
// }
// if (s === 'false') {
// return false;
// }
// }

export function castBool(v: any): ?boolean {
if (v === true || v === false) {
Expand Down