Skip to content

Commit a108580

Browse files
committed
Ensure updates are applied when diffInCommitPhase is on
In this case there's no updatePayload.
1 parent 613e6f5 commit a108580

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

packages/react-dom/src/__tests__/ReactDOMFloat-test.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7084,5 +7084,26 @@ background-color: green;
70847084
</html>,
70857085
);
70867086
});
7087+
7088+
// @gate enableFloat
7089+
it('can update title tags', async () => {
7090+
const root = ReactDOMClient.createRoot(container);
7091+
await act(() => {
7092+
root.render(<title data-foo="foo">a title</title>);
7093+
});
7094+
await waitForAll([]);
7095+
7096+
expect(getMeaningfulChildren(document.head)).toEqual(
7097+
<title data-foo="foo">a title</title>,
7098+
);
7099+
7100+
await act(() => {
7101+
root.render(<title data-foo="bar">another title</title>);
7102+
});
7103+
await waitForAll([]);
7104+
expect(getMeaningfulChildren(document.head)).toEqual(
7105+
<title data-foo="bar">another title</title>,
7106+
);
7107+
});
70877108
});
70887109
});

packages/react-reconciler/src/ReactFiberCommitWork.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2692,7 +2692,7 @@ function commitMutationEffectsOnFiber(
26922692
const updatePayload: null | UpdatePayload =
26932693
(finishedWork.updateQueue: any);
26942694
finishedWork.updateQueue = null;
2695-
if (updatePayload !== null) {
2695+
if (updatePayload !== null || diffInCommitPhase) {
26962696
try {
26972697
commitUpdate(
26982698
finishedWork.stateNode,

0 commit comments

Comments
 (0)