MCPcopy
hub / github.com/facebook/react / action

Function action

packages/react-client/src/ReactFlightReplyClient.js:1293–1311  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1291 const id = metaData.id;
1292 const bound = metaData.bound;
1293 let action = function (): Promise<T> {
1294 // $FlowFixMe[method-unbinding]
1295 const args = Array.prototype.slice.call(arguments);
1296 const p = bound;
1297 if (!p) {
1298 return callServer(id, args);
1299 }
1300 if (p.status === 'fulfilled') {
1301 const boundArgs = p.value;
1302 return callServer(id, boundArgs.concat(args));
1303 }
1304 // Since this is a fake Promise whose .then doesn't chain, we have to wrap it.
1305 // TODO: Remove the wrapper once that's fixed.
1306 return ((Promise.resolve(p): any): Promise<Array<any>>).then(
1307 function (boundArgs) {
1308 return callServer(id, boundArgs.concat(args));
1309 },
1310 );
1311 };
1312 if (__DEV__) {
1313 const location = metaData.location;
1314 if (location) {

Callers 5

ReactFiberHooks.jsFile · 0.50
useThunkDispatchFunction · 0.50
handleActionFunction · 0.50
region.jsFile · 0.50
region.jsFile · 0.50

Calls 2

thenMethod · 0.65
callServerFunction · 0.50

Tested by 1

useThunkDispatchFunction · 0.40