Skip to content

Commit 6688217

Browse files
committed
Don't apply update if we have already applied a name to this element
1 parent edd0ecb commit 6688217

File tree

2 files changed

+25
-18
lines changed

2 files changed

+25
-18
lines changed

packages/react-dom-bindings/src/server/fizz-instruction-set/ReactDOMFizzInstructionSetInlineCodeStrings.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/react-dom-bindings/src/server/fizz-instruction-set/ReactDOMFizzInstructionSetShared.js

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export function revealCompletedBoundariesWithViewTransitions(
9090
const restoreQueue = [];
9191
function applyViewTransitionName(element, classAttributeName) {
9292
const className = element.getAttribute(classAttributeName);
93-
if (!className || className === 'none') {
93+
if (!className) {
9494
return;
9595
}
9696
// Add any elements we apply a name to a queue to be reverted when we start.
@@ -161,22 +161,6 @@ export function revealCompletedBoundariesWithViewTransitions(
161161
continue;
162162
}
163163

164-
// Apply update animations to any parents and siblings that might be affected.
165-
let ancestorElement = parentInstance;
166-
do {
167-
let childElement = ancestorElement.firstElementChild;
168-
while (childElement) {
169-
// TODO: Bail out if we can
170-
// TODO: If we have already handled this element as part of another exit/enter/share, don't override.
171-
applyViewTransitionName(childElement, 'vt-update');
172-
childElement = childElement.nextElementSibling;
173-
}
174-
} while (
175-
(ancestorElement = ancestorElement.parentNode) &&
176-
ancestorElement.nodeType === ELEMENT_NODE &&
177-
ancestorElement.getAttribute('vt-update') !== 'none'
178-
);
179-
180164
// Apply exit animations to the immediate elements inside the fallback.
181165
let node = suspenseIdNode;
182166
let depth = 0;
@@ -239,6 +223,29 @@ export function revealCompletedBoundariesWithViewTransitions(
239223
}
240224
enterElement = enterElement.nextElementSibling;
241225
}
226+
227+
// Apply update animations to any parents and siblings that might be affected.
228+
let ancestorElement = parentInstance;
229+
do {
230+
let childElement = ancestorElement.firstElementChild;
231+
while (childElement) {
232+
// TODO: Bail out if we can
233+
const updateClassName = childElement.getAttribute('vt-update');
234+
if (
235+
updateClassName &&
236+
updateClassName !== 'none' &&
237+
!restoreQueue.includes(childElement)
238+
) {
239+
// If we have already handled this element as part of another exit/enter/share, don't override.
240+
applyViewTransitionName(childElement, 'vt-update');
241+
}
242+
childElement = childElement.nextElementSibling;
243+
}
244+
} while (
245+
(ancestorElement = ancestorElement.parentNode) &&
246+
ancestorElement.nodeType === ELEMENT_NODE &&
247+
ancestorElement.getAttribute('vt-update') !== 'none'
248+
);
242249
}
243250
if (shouldStartViewTransition) {
244251
const transition = (document['__reactViewTransition'] = document[

0 commit comments

Comments
 (0)