Skip to content

Commit

Permalink
Fix Flow issues in Replay RDT fork
Browse files Browse the repository at this point in the history
  • Loading branch information
markerikson committed Jul 1, 2024
1 parent 849217d commit 680ad6d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
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-shared/src/backend/agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion packages/react-devtools-shared/src/backend/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2485,7 +2485,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

0 comments on commit 680ad6d

Please sign in to comment.