You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

@zag-js/react

Package Overview
Dependencies
Maintainers
1
Versions
1006
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zag-js/react - npm Package Compare versions

Comparing version

to
1.6.2

19

dist/index.js

@@ -251,6 +251,6 @@ "use client";

if (cleanup) effects.current.set(nextState, cleanup);
if (prevState === "__init__") {
if (prevState === core.INIT_STATE) {
action(machine.entry);
const cleanup2 = effect(machine.effects);
if (cleanup2) effects.current.set("__init__", cleanup2);
if (cleanup2) effects.current.set(core.INIT_STATE, cleanup2);
}

@@ -261,10 +261,17 @@ action(machine.states[nextState]?.entry);

const hydratedStateRef = React.useRef(void 0);
const statusRef = React.useRef(core.MachineStatus.NotStarted);
useSafeLayoutEffect(() => {
queueMicrotask(() => {
const started = statusRef.current === core.MachineStatus.Started;
statusRef.current = core.MachineStatus.Started;
debug(started ? "rehydrating..." : "initializing...");
const initialState = hydratedStateRef.current ?? state.initial;
state.invoke(initialState, "__init__");
state.invoke(initialState, started ? state.get() : core.INIT_STATE);
});
const fns = effects.current;
const currentState = state.ref.current;
return () => {
hydratedStateRef.current = state.ref.current;
debug("unmounting...");
hydratedStateRef.current = currentState;
statusRef.current = core.MachineStatus.Stopped;
fns.forEach((fn) => fn?.());

@@ -284,2 +291,3 @@ effects.current = /* @__PURE__ */ new Map();

queueMicrotask(() => {
if (statusRef.current !== core.MachineStatus.Started) return;
previousEventRef.current = eventRef.current;

@@ -318,3 +326,4 @@ eventRef.current = event;

computed,
event: getEvent()
event: getEvent(),
getStatus: () => statusRef.current
};

@@ -321,0 +330,0 @@ }

{
"name": "@zag-js/react",
"version": "1.6.1",
"version": "1.6.2",
"description": "The react wrapper for zag",

@@ -28,6 +28,6 @@ "keywords": [

"dependencies": {
"@zag-js/core": "1.6.1",
"@zag-js/store": "1.6.1",
"@zag-js/types": "1.6.1",
"@zag-js/utils": "1.6.1"
"@zag-js/core": "1.6.2",
"@zag-js/store": "1.6.2",
"@zag-js/types": "1.6.2",
"@zag-js/utils": "1.6.2"
},

@@ -34,0 +34,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet