Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@react-aria/virtualizer

Package Overview
Dependencies
Maintainers
2
Versions
842
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-aria/virtualizer - npm Package Compare versions

Comparing version 3.0.0-nightly-4980928d3-240906 to 3.0.0-nightly-5a0b4fabc-240924

42

dist/ScrollView.main.js

@@ -114,5 +114,9 @@ var $efdd61e59e023a1d$exports = require("./utils.main.js");

}, []);
let isUpdatingSize = (0, $kvIfm$react.useRef)(false);
let updateSize = (0, $kvIfm$reactariautils.useEffectEvent)((flush)=>{
let dom = ref.current;
if (!dom) return;
if (!dom && !isUpdatingSize.current) return;
// Prevent reentrancy when resize observer fires, triggers re-layout that results in
// content size update, causing below layout effect to fire. This avoids infinite loops.
isUpdatingSize.current = true;
let isTestEnv = false;

@@ -144,26 +148,20 @@ let isClientWidthMocked = Object.getOwnPropertyNames(window.HTMLElement.prototype).includes('clientWidth');

}
isUpdatingSize.current = false;
});
let didUpdateSize = (0, $kvIfm$react.useRef)(false);
// Update visible rect when the content size changes, in case scrollbars need to appear or disappear.
let lastContentSize = (0, $kvIfm$react.useRef)(null);
(0, $kvIfm$reactariautils.useLayoutEffect)(()=>{
// React doesn't allow flushSync inside effects, so queue a microtask.
// We also need to wait until all refs are set (e.g. when passing a ref down from a parent).
queueMicrotask(()=>{
if (!didUpdateSize.current) {
didUpdateSize.current = true;
updateSize((0, $kvIfm$reactdom.flushSync));
}
});
}, [
updateSize
]);
(0, $kvIfm$react.useEffect)(()=>{
if (!didUpdateSize.current) {
// If useEffect ran before the above microtask, we are in a synchronous render (e.g. act).
// Update the size here so that you don't need to mock timers in tests.
didUpdateSize.current = true;
updateSize((fn)=>fn());
if (!isUpdatingSize.current && (lastContentSize.current == null || !contentSize.equals(lastContentSize.current))) {
// React doesn't allow flushSync inside effects, so queue a microtask.
// We also need to wait until all refs are set (e.g. when passing a ref down from a parent).
// If we are in an `act` environment, update immediately without a microtask so you don't need
// to mock timers in tests. In this case, the update is synchronous already.
// IS_REACT_ACT_ENVIRONMENT is used by React 18. Previous versions checked for the `jest` global.
// https://github.com/reactwg/react-18/discussions/102
// @ts-ignore
if (typeof IS_REACT_ACT_ENVIRONMENT === 'boolean' ? IS_REACT_ACT_ENVIRONMENT : typeof jest !== 'undefined') updateSize((fn)=>fn());
else queueMicrotask(()=>updateSize((0, $kvIfm$reactdom.flushSync)));
}
}, [
updateSize
]);
lastContentSize.current = contentSize;
});
let onResize = (0, $kvIfm$react.useCallback)(()=>{

@@ -170,0 +168,0 @@ updateSize((0, $kvIfm$reactdom.flushSync));

@@ -103,5 +103,9 @@ import {getScrollLeft as $ce415dc67314b753$export$1389d168952b34b5} from "./utils.module.js";

}, []);
let isUpdatingSize = (0, $f9kpT$useRef)(false);
let updateSize = (0, $f9kpT$useEffectEvent)((flush)=>{
let dom = ref.current;
if (!dom) return;
if (!dom && !isUpdatingSize.current) return;
// Prevent reentrancy when resize observer fires, triggers re-layout that results in
// content size update, causing below layout effect to fire. This avoids infinite loops.
isUpdatingSize.current = true;
let isTestEnv = false;

@@ -133,26 +137,20 @@ let isClientWidthMocked = Object.getOwnPropertyNames(window.HTMLElement.prototype).includes('clientWidth');

}
isUpdatingSize.current = false;
});
let didUpdateSize = (0, $f9kpT$useRef)(false);
// Update visible rect when the content size changes, in case scrollbars need to appear or disappear.
let lastContentSize = (0, $f9kpT$useRef)(null);
(0, $f9kpT$useLayoutEffect)(()=>{
// React doesn't allow flushSync inside effects, so queue a microtask.
// We also need to wait until all refs are set (e.g. when passing a ref down from a parent).
queueMicrotask(()=>{
if (!didUpdateSize.current) {
didUpdateSize.current = true;
updateSize((0, $f9kpT$flushSync));
}
});
}, [
updateSize
]);
(0, $f9kpT$useEffect)(()=>{
if (!didUpdateSize.current) {
// If useEffect ran before the above microtask, we are in a synchronous render (e.g. act).
// Update the size here so that you don't need to mock timers in tests.
didUpdateSize.current = true;
updateSize((fn)=>fn());
if (!isUpdatingSize.current && (lastContentSize.current == null || !contentSize.equals(lastContentSize.current))) {
// React doesn't allow flushSync inside effects, so queue a microtask.
// We also need to wait until all refs are set (e.g. when passing a ref down from a parent).
// If we are in an `act` environment, update immediately without a microtask so you don't need
// to mock timers in tests. In this case, the update is synchronous already.
// IS_REACT_ACT_ENVIRONMENT is used by React 18. Previous versions checked for the `jest` global.
// https://github.com/reactwg/react-18/discussions/102
// @ts-ignore
if (typeof IS_REACT_ACT_ENVIRONMENT === 'boolean' ? IS_REACT_ACT_ENVIRONMENT : typeof jest !== 'undefined') updateSize((fn)=>fn());
else queueMicrotask(()=>updateSize((0, $f9kpT$flushSync)));
}
}, [
updateSize
]);
lastContentSize.current = contentSize;
});
let onResize = (0, $f9kpT$useCallback)(()=>{

@@ -159,0 +157,0 @@ updateSize((0, $f9kpT$flushSync));

@@ -316,2 +316,3 @@ import { Direction, Key, RefObject, Collection } from "@react-types/shared";

parent?: LayoutInfo | null;
style?: CSSProperties;
className?: string;

@@ -318,0 +319,0 @@ children: ReactNode;

@@ -30,3 +30,3 @@ var $7d70e069fceb2deb$exports = require("./useVirtualizerItem.main.js");

function $d6a26279cc31826b$export$6796df8ba7398521(props) {
let { className: className, layoutInfo: layoutInfo, virtualizer: virtualizer, parent: parent, children: children } = props;
let { style: style, className: className, layoutInfo: layoutInfo, virtualizer: virtualizer, parent: parent, children: children } = props;
let { direction: direction } = (0, $eXWCF$reactariai18n.useLocale)();

@@ -43,3 +43,6 @@ let ref = (0, $eXWCF$react.useRef)(undefined);

className: className,
style: $d6a26279cc31826b$export$1481e64fbe01b8b3(layoutInfo, direction, parent)
style: {
...$d6a26279cc31826b$export$1481e64fbe01b8b3(layoutInfo, direction, parent),
...style
}
}, children);

@@ -46,0 +49,0 @@ }

@@ -19,3 +19,3 @@ import {useVirtualizerItem as $47736c1e63ba1c6d$export$1da781778207e0a2} from "./useVirtualizerItem.module.js";

function $ccf8a0a04e4175ae$export$6796df8ba7398521(props) {
let { className: className, layoutInfo: layoutInfo, virtualizer: virtualizer, parent: parent, children: children } = props;
let { style: style, className: className, layoutInfo: layoutInfo, virtualizer: virtualizer, parent: parent, children: children } = props;
let { direction: direction } = (0, $ivH3G$useLocale)();

@@ -32,3 +32,6 @@ let ref = (0, $ivH3G$useRef)(undefined);

className: className,
style: $ccf8a0a04e4175ae$export$1481e64fbe01b8b3(layoutInfo, direction, parent)
style: {
...$ccf8a0a04e4175ae$export$1481e64fbe01b8b3(layoutInfo, direction, parent),
...style
}
}, children);

@@ -35,0 +38,0 @@ }

{
"name": "@react-aria/virtualizer",
"version": "3.0.0-nightly-4980928d3-240906",
"version": "3.0.0-nightly-5a0b4fabc-240924",
"description": "Spectrum UI components in React",

@@ -25,7 +25,7 @@ "license": "Apache-2.0",

"dependencies": {
"@react-aria/i18n": "^3.0.0-nightly-4980928d3-240906",
"@react-aria/interactions": "^3.0.0-nightly-4980928d3-240906",
"@react-aria/utils": "^3.0.0-nightly-4980928d3-240906",
"@react-stately/virtualizer": "^3.0.0-nightly-4980928d3-240906",
"@react-types/shared": "^3.0.0-nightly-4980928d3-240906",
"@react-aria/i18n": "^3.0.0-nightly-5a0b4fabc-240924",
"@react-aria/interactions": "^3.0.0-nightly-5a0b4fabc-240924",
"@react-aria/utils": "^3.0.0-nightly-5a0b4fabc-240924",
"@react-stately/virtualizer": "^3.0.0-nightly-5a0b4fabc-240924",
"@react-types/shared": "^3.0.0-nightly-5a0b4fabc-240924",
"@swc/helpers": "^0.5.0"

@@ -32,0 +32,0 @@ },

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

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc