revealCompletedBoundariesWithViewTransitions() — react Function Reference
Architecture documentation for the revealCompletedBoundariesWithViewTransitions() function in ReactDOMFizzInstructionSetShared.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD a642e1ea_2043_92a7_3a9c_7cb96f871a6f["revealCompletedBoundariesWithViewTransitions()"] 2a61726f_9a35_9713_662f_bfb1ef81f49f["ReactDOMFizzInstructionSetShared.js"] a642e1ea_2043_92a7_3a9c_7cb96f871a6f -->|defined in| 2a61726f_9a35_9713_662f_bfb1ef81f49f style a642e1ea_2043_92a7_3a9c_7cb96f871a6f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/react-dom-bindings/src/server/fizz-instruction-set/ReactDOMFizzInstructionSetShared.js lines 103–364
export function revealCompletedBoundariesWithViewTransitions(
revealBoundaries,
batch,
) {
let shouldStartViewTransition = false;
let autoNameIdx = 0;
const restoreQueue = [];
function applyViewTransitionName(element, classAttributeName) {
const className = element.getAttribute(classAttributeName);
if (!className) {
return;
}
// Add any elements we apply a name to a queue to be reverted when we start.
const elementStyle = element.style;
restoreQueue.push(
element,
elementStyle['viewTransitionName'],
elementStyle['viewTransitionClass'],
);
if (className !== 'auto') {
elementStyle['viewTransitionClass'] = className;
}
let name = element.getAttribute('vt-name');
if (!name) {
// Auto-generate a name for this one.
// TODO: We don't have a prefix to pick from here but maybe we don't need it
// since it's only applicable temporarily during this specific animation.
const idPrefix = '';
name = '_' + idPrefix + 'T_' + autoNameIdx++ + '_';
}
// If the name isn't valid CSS identifier, base64 encode the name instead.
// This doesn't let you select it in custom CSS selectors but it does work in current
// browsers.
const escapedName =
CSS.escape(name) !== name ? 'r-' + btoa(name).replace(/=/g, '') : name;
elementStyle['viewTransitionName'] = escapedName;
shouldStartViewTransition = true;
}
try {
const existingTransition = document['__reactViewTransition'];
if (existingTransition) {
// Retry after the previous ViewTransition finishes.
existingTransition.finished.finally(window['$RV'].bind(null, batch));
return;
}
// First collect all entering names that might form pairs exiting names.
const appearingViewTransitions = new Map();
for (let i = 1; i < batch.length; i += 2) {
const contentNode = batch[i];
const appearingElements = contentNode.querySelectorAll('[vt-share]');
for (let j = 0; j < appearingElements.length; j++) {
const appearingElement = appearingElements[j];
appearingViewTransitions.set(
appearingElement.getAttribute('vt-name'),
appearingElement,
);
}
}
const suspenseyImages = [];
// Next we'll find the nodes that we're going to animate and apply names to them..
for (let i = 0; i < batch.length; i += 2) {
const suspenseIdNode = batch[i];
const parentInstance = suspenseIdNode.parentNode;
if (!parentInstance) {
// We may have client-rendered this boundary already. Skip it.
continue;
}
const parentRect = parentInstance.getBoundingClientRect();
if (
!parentRect.left &&
!parentRect.top &&
!parentRect.width &&
!parentRect.height
) {
// If the parent instance is display: none then we don't animate this boundary.
// This can happen when this boundary is actually a child of a different boundary that
// isn't yet revealed or is about to be revealed, but in that case that boundary
// should do the exit/enter and not this one. Conveniently this also lets us skip
// this if it's just in a hidden tree in general.
// TODO: Should we skip it if it's out of viewport? It's possible that it gets
// brought into the viewport by changing size.
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does revealCompletedBoundariesWithViewTransitions() do?
revealCompletedBoundariesWithViewTransitions() is a function in the react codebase, defined in packages/react-dom-bindings/src/server/fizz-instruction-set/ReactDOMFizzInstructionSetShared.js.
Where is revealCompletedBoundariesWithViewTransitions() defined?
revealCompletedBoundariesWithViewTransitions() is defined in packages/react-dom-bindings/src/server/fizz-instruction-set/ReactDOMFizzInstructionSetShared.js at line 103.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free