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

@restart/ui

Package Overview
Dependencies
Maintainers
3
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@restart/ui - npm Package Compare versions

Comparing version 1.5.2 to 1.5.3

1

cjs/ImperativeTransition.d.ts

@@ -7,2 +7,3 @@ import React from 'react';

initial: boolean;
isStale: () => boolean;
}

@@ -9,0 +10,0 @@ export type TransitionHandler = (options: TransitionFunctionOptions) => void | Promise<void>;

@@ -24,9 +24,14 @@ "use strict";

if (!ref.current) {
return;
return undefined;
}
let stale = false;
handleTransition({
in: inProp,
element: ref.current,
initial: isInitialRef.current
initial: isInitialRef.current,
isStale: () => stale
});
return () => {
stale = true;
};
}, [inProp, handleTransition]);

@@ -56,2 +61,7 @@ (0, _react.useEffect)(() => {

const [exited, setExited] = (0, _react.useState)(!inProp);
// TODO: I think this needs to be in an effect
if (inProp && exited) {
setExited(false);
}
const ref = useTransition({

@@ -61,4 +71,4 @@ in: !!inProp,

const onFinish = () => {
if (options.isStale()) return;
if (options.in) {
setExited(false);
onEntered == null ? void 0 : onEntered(options.element, options.initial);

@@ -70,3 +80,6 @@ } else {

};
Promise.resolve(transition(options)).then(onFinish);
Promise.resolve(transition(options)).then(onFinish, error => {
if (!options.in) setExited(true);
throw error;
});
}

@@ -73,0 +86,0 @@ });

@@ -7,2 +7,3 @@ import React from 'react';

initial: boolean;
isStale: () => boolean;
}

@@ -9,0 +10,0 @@ export type TransitionHandler = (options: TransitionFunctionOptions) => void | Promise<void>;

@@ -15,9 +15,14 @@ import useMergedRefs from '@restart/hooks/useMergedRefs';

if (!ref.current) {
return;
return undefined;
}
let stale = false;
handleTransition({
in: inProp,
element: ref.current,
initial: isInitialRef.current
initial: isInitialRef.current,
isStale: () => stale
});
return () => {
stale = true;
};
}, [inProp, handleTransition]);

@@ -47,2 +52,7 @@ useEffect(() => {

const [exited, setExited] = useState(!inProp);
// TODO: I think this needs to be in an effect
if (inProp && exited) {
setExited(false);
}
const ref = useTransition({

@@ -52,4 +62,4 @@ in: !!inProp,

const onFinish = () => {
if (options.isStale()) return;
if (options.in) {
setExited(false);
onEntered == null ? void 0 : onEntered(options.element, options.initial);

@@ -61,3 +71,6 @@ } else {

};
Promise.resolve(transition(options)).then(onFinish);
Promise.resolve(transition(options)).then(onFinish, error => {
if (!options.in) setExited(true);
throw error;
});
}

@@ -64,0 +77,0 @@ });

2

package.json
{
"name": "@restart/ui",
"version": "1.5.2",
"version": "1.5.3",
"description": "Utilities for creating robust overlay components",

@@ -5,0 +5,0 @@ "author": {

Sorry, the diff of this file is too big to display

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