Skip to content

Commit

Permalink
Fix Flow types of useEffectEvent (#26468)
Browse files Browse the repository at this point in the history
## Summary

Just copied the types over from the internal types. Type error was
hidden by overly broad FlowFixMe. With `$FlowFixMe[not-a-function]` we
would've seen the actual issue:
```
Cannot return `dispatcher.useEffectEvent(...)` because  `T` [1] is incompatible with  undefined [2].Flow(incompatible-return)
```

## How did you test this change?

- [x] yarn flow dom-node
- [x] CI

DiffTrain build for [d12bdcd](d12bdcd)
  • Loading branch information
eps1lon committed Mar 25, 2023
1 parent 390ac45 commit a8b6d3f
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
73b6435ca4e0c3ae3aac8126509a82420a84f0d7
d12bdcda69afd219f4d91cbd60d6fae2a375d35b
10 changes: 5 additions & 5 deletions compiled/facebook-www/React-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (
}
"use strict";

var ReactVersion = "18.3.0-www-classic-e762d1a9";
var ReactVersion = "18.3.0-www-classic-1745b9a1";

// ATTENTION
// When adding new symbols to this file,
Expand Down Expand Up @@ -2011,22 +2011,22 @@ function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
);
}
function useCacheRefresh() {
var dispatcher = resolveDispatcher(); // $FlowFixMe This is unstable, thus optional
var dispatcher = resolveDispatcher(); // $FlowFixMe[not-a-function] This is unstable, thus optional

return dispatcher.useCacheRefresh();
}
function use(usable) {
var dispatcher = resolveDispatcher(); // $FlowFixMe This is unstable, thus optional
var dispatcher = resolveDispatcher(); // $FlowFixMe[not-a-function] This is unstable, thus optional

return dispatcher.use(usable);
}
function useMemoCache(size) {
var dispatcher = resolveDispatcher(); // $FlowFixMe This is unstable, thus optional
var dispatcher = resolveDispatcher(); // $FlowFixMe[not-a-function] This is unstable, thus optional

return dispatcher.useMemoCache(size);
}
function useEffectEvent(callback) {
var dispatcher = resolveDispatcher(); // $FlowFixMe This is unstable, thus optional
var dispatcher = resolveDispatcher(); // $FlowFixMe[not-a-function] This is unstable, thus optional

return dispatcher.useEffectEvent(callback);
}
Expand Down
10 changes: 5 additions & 5 deletions compiled/facebook-www/React-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (
}
"use strict";

var ReactVersion = "18.3.0-www-modern-11df97fe";
var ReactVersion = "18.3.0-www-modern-770d70a2";

// ATTENTION
// When adding new symbols to this file,
Expand Down Expand Up @@ -2011,22 +2011,22 @@ function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
);
}
function useCacheRefresh() {
var dispatcher = resolveDispatcher(); // $FlowFixMe This is unstable, thus optional
var dispatcher = resolveDispatcher(); // $FlowFixMe[not-a-function] This is unstable, thus optional

return dispatcher.useCacheRefresh();
}
function use(usable) {
var dispatcher = resolveDispatcher(); // $FlowFixMe This is unstable, thus optional
var dispatcher = resolveDispatcher(); // $FlowFixMe[not-a-function] This is unstable, thus optional

return dispatcher.use(usable);
}
function useMemoCache(size) {
var dispatcher = resolveDispatcher(); // $FlowFixMe This is unstable, thus optional
var dispatcher = resolveDispatcher(); // $FlowFixMe[not-a-function] This is unstable, thus optional

return dispatcher.useMemoCache(size);
}
function useEffectEvent(callback) {
var dispatcher = resolveDispatcher(); // $FlowFixMe This is unstable, thus optional
var dispatcher = resolveDispatcher(); // $FlowFixMe[not-a-function] This is unstable, thus optional

return dispatcher.useEffectEvent(callback);
}
Expand Down
6 changes: 3 additions & 3 deletions compiled/facebook-www/ReactDOMTesting-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -15987,7 +15987,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1754 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "18.3.0-www-modern-11df97fe",
version: "18.3.0-www-modern-770d70a2",
rendererPackageName: "react-dom"
};
var internals$jscomp$inline_2154 = {
Expand Down Expand Up @@ -16018,7 +16018,7 @@ var internals$jscomp$inline_2154 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-www-modern-11df97fe"
reconcilerVersion: "18.3.0-www-modern-770d70a2"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2155 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -16338,4 +16338,4 @@ exports.unstable_createEventHandle = function (type, options) {
return eventHandle;
};
exports.unstable_runWithPriority = runWithPriority;
exports.version = "18.3.0-www-modern-11df97fe";
exports.version = "18.3.0-www-modern-770d70a2";
2 changes: 1 addition & 1 deletion compiled/facebook-www/ReactTestRenderer-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -24353,7 +24353,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-www-modern-11df97fe";
var ReactVersion = "18.3.0-www-modern-770d70a2";

// Might add PROFILE later.

Expand Down

0 comments on commit a8b6d3f

Please sign in to comment.