@react-aria/ssr
Advanced tools
Comparing version 3.0.0-nightly.2359 to 3.0.0
@@ -30,12 +30,11 @@ var _react2 = require("react"); | ||
* When using SSR with React Aria, applications must be wrapped in an SSRProvider. | ||
* This ensures that auto generated ids are consistent between the client and server | ||
* by resetting the incremented value on each request. | ||
* This ensures that auto generated ids are consistent between the client and server. | ||
*/ | ||
function SSRProvider(props) { | ||
let cur = useContext($e873f27652f6cc1e1ee5ebcb9b5e51$var$SSRContext); | ||
let value = { | ||
let value = useMemo(() => ({ | ||
// If this is the first SSRProvider, set to zero, otherwise increment. | ||
prefix: cur === $e873f27652f6cc1e1ee5ebcb9b5e51$var$defaultContext ? 0 : cur.prefix + 1, | ||
prefix: cur === $e873f27652f6cc1e1ee5ebcb9b5e51$var$defaultContext ? 0 : ++cur.prefix, | ||
current: 0 | ||
}; | ||
}), [cur]); | ||
return /*#__PURE__*/_react.createElement($e873f27652f6cc1e1ee5ebcb9b5e51$var$SSRContext.Provider, { | ||
@@ -60,3 +59,7 @@ value: value | ||
} | ||
/** @private */ | ||
/** | ||
* Returns whether the component is currently being server side rendered or | ||
* hydrated on the client. Can be used to delay browser-specific rendering | ||
* until after hydration. | ||
*/ | ||
@@ -63,0 +66,0 @@ |
@@ -16,12 +16,11 @@ import _react, { useContext, useLayoutEffect, useMemo, useState } from "react"; | ||
* When using SSR with React Aria, applications must be wrapped in an SSRProvider. | ||
* This ensures that auto generated ids are consistent between the client and server | ||
* by resetting the incremented value on each request. | ||
* This ensures that auto generated ids are consistent between the client and server. | ||
*/ | ||
export function SSRProvider(props) { | ||
let cur = useContext($f01a183cc7bdff77849e49ad26eb904$var$SSRContext); | ||
let value = { | ||
let value = useMemo(() => ({ | ||
// If this is the first SSRProvider, set to zero, otherwise increment. | ||
prefix: cur === $f01a183cc7bdff77849e49ad26eb904$var$defaultContext ? 0 : cur.prefix + 1, | ||
prefix: cur === $f01a183cc7bdff77849e49ad26eb904$var$defaultContext ? 0 : ++cur.prefix, | ||
current: 0 | ||
}; | ||
}), [cur]); | ||
return /*#__PURE__*/_react.createElement($f01a183cc7bdff77849e49ad26eb904$var$SSRContext.Provider, { | ||
@@ -44,3 +43,7 @@ value: value | ||
} | ||
/** @private */ | ||
/** | ||
* Returns whether the component is currently being server side rendered or | ||
* hydrated on the client. Can be used to delay browser-specific rendering | ||
* until after hydration. | ||
*/ | ||
@@ -47,0 +50,0 @@ export function useIsSSR() { |
import { ReactNode } from "react"; | ||
interface SSRProviderProps { | ||
/** Your application here. */ | ||
children: ReactNode; | ||
@@ -7,4 +8,3 @@ } | ||
* When using SSR with React Aria, applications must be wrapped in an SSRProvider. | ||
* This ensures that auto generated ids are consistent between the client and server | ||
* by resetting the incremented value on each request. | ||
* This ensures that auto generated ids are consistent between the client and server. | ||
*/ | ||
@@ -14,5 +14,9 @@ export function SSRProvider(props: SSRProviderProps): JSX.Element; | ||
export function useSSRSafeId(defaultId?: string): string; | ||
/** @private */ | ||
/** | ||
* Returns whether the component is currently being server side rendered or | ||
* hydrated on the client. Can be used to delay browser-specific rendering | ||
* until after hydration. | ||
*/ | ||
export function useIsSSR(): boolean; | ||
//# sourceMappingURL=types.d.ts.map |
{ | ||
"name": "@react-aria/ssr", | ||
"version": "3.0.0-nightly.2359+1ad0f163", | ||
"version": "3.0.0", | ||
"description": "Spectrum UI components in React", | ||
@@ -28,3 +28,3 @@ "license": "Apache-2.0", | ||
}, | ||
"gitHead": "1ad0f16354f7114e4ecfa5c75b16ec6f11ff1ec0" | ||
"gitHead": "d050016e6876b20e4d8a95ba5fb5630d78e75a60" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
37740
247
1
0