@mui/internal-docs-infra
Version:
MUI Infra - internal documentation creation tools.
19 lines (17 loc) • 902 B
JavaScript
'use client';
import * as React from 'react';
/**
* The ambient settle gate that a {@link CoordinatedLazy} swap registers with
* when it isn't given an explicit `gate` prop. A coordinator (e.g. the
* `useStream` controller) provides its gate here so every swap rendered beneath
* it reports into the same gate - that is how a group's `loading` reflects each
* piece's swap without threading a `gate` prop through every one. `null` outside
* any coordinator, in which case the swap registers only with the page-global
* gate.
*/
export const CoordinatedGateContext = /*#__PURE__*/React.createContext(null);
/** Read the ambient settle gate, or `null` when there is no surrounding coordinator. */
if (process.env.NODE_ENV !== "production") CoordinatedGateContext.displayName = "CoordinatedGateContext";
export function useCoordinatedGate() {
return React.useContext(CoordinatedGateContext);
}