Skip to content

Commit 5bd1a88

Browse files
committed
fix: separate ref for consistency
1 parent 0931bab commit 5bd1a88

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/block/heading/edit.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,12 @@ const Edit = props => {
103103
// Auto-generate anchors in Stackable headings.
104104
const [ prevText, setPrevText ] = useState( props.attributes.text )
105105
const updateTimeout = useRef( null )
106+
const isFirstRender = useRef( true )
106107

107108
useEffect( () => {
108109
// Use updateTimeout to skip effect on first render
109-
if ( updateTimeout.current === null ) {
110-
updateTimeout.current = true
110+
if ( isFirstRender.current ) {
111+
isFirstRender.current = false
111112
return
112113
}
113114

0 commit comments

Comments
 (0)