MCPcopy Create free account
hub / github.com/BetaSu/big-react / enqueueUpdate

Function enqueueUpdate

packages/react-reconciler/src/updateQueue.ts:45–68  ·  view source on GitHub ↗
(
	updateQueue: UpdateQueue<State>,
	update: Update<State>,
	fiber: FiberNode,
	lane: Lane
)

Source from the content-addressed store, hash-verified

43};
44
45export const enqueueUpdate = <State>(
46 updateQueue: UpdateQueue<State>,
47 update: Update<State>,
48 fiber: FiberNode,
49 lane: Lane
50) => {
51 const pending = updateQueue.shared.pending;
52 if (pending === null) {
53 // pending = a -> a
54 update.next = update;
55 } else {
56 // pending = b -> a -> b
57 // pending = c -> a -> b -> c
58 update.next = pending.next;
59 pending.next = update;
60 }
61 updateQueue.shared.pending = update;
62
63 fiber.lanes = mergeLanes(fiber.lanes, lane);
64 const alternate = fiber.alternate;
65 if (alternate !== null) {
66 alternate.lanes = mergeLanes(alternate.lanes, lane);
67 }
68};
69
70export function basicStateReducer<State>(
71 state: State,

Callers 2

updateContainerFunction · 0.90
dispatchSetStateFunction · 0.90

Calls 1

mergeLanesFunction · 0.90

Tested by

no test coverage detected