Skip to content

Commit 6967942

Browse files
committed
fix: fix render with StrictMode
1 parent 7c449d2 commit 6967942

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

.storybook/theme.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { create } from '@storybook/theming';
22

33
export default create({
44
base: 'dark',
5-
65
brandTitle: 'react-transitioning',
76
brandUrl: 'https://fakundo.github.io/react-transitioning/',
87
brandImage: undefined,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-transitioning",
3-
"version": "1.0.4",
3+
"version": "1.0.5",
44
"description": "React components for easily implementing basic CSS animations and transitions",
55
"main": "dist/index.cjs.js",
66
"module": "dist/index.esm.js",

src/Transition.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useState, useEffect, useMemo } from 'react';
1+
import { useState, useEffect, useMemo, useRef } from 'react';
22
import { useIsoEffect } from './useIsoEffect';
33

44
/**
@@ -138,11 +138,11 @@ export function Transition(props: TransitionProps) {
138138
addEndListener,
139139
} = props;
140140

141-
let ignoreInPropChange = false;
141+
const ignoreInPropChangeRef = useRef(false);
142142

143143
// Make phase state
144144
const [phase, setPhase] = useState(() => {
145-
ignoreInPropChange = true;
145+
ignoreInPropChangeRef.current = true;
146146
if (!inProp) {
147147
return TransitionPhase.EXIT_DONE;
148148
}
@@ -179,7 +179,7 @@ export function Transition(props: TransitionProps) {
179179

180180
// Effect for initial phase
181181
useIsoEffect(() => {
182-
if (!ignoreInPropChange) {
182+
if (!ignoreInPropChangeRef.current) {
183183
if (inProp) {
184184
setPhase(enter ? TransitionPhase.ENTER : TransitionPhase.ENTER_DONE);
185185
} else {

0 commit comments

Comments
 (0)