@awey/react-chart-container
Advanced tools
Comparing version 1.1.3 to 1.1.4
@@ -1,2 +0,2 @@ | ||
import require$$0, { useState, useEffect, useMemo, useRef, useCallback } from "react"; | ||
import require$$0, { useRef, useEffect, useState, useMemo, useCallback } from "react"; | ||
import { addListener, removeListener } from "resize-detector"; | ||
@@ -972,2 +972,8 @@ import { deepEqual } from "fast-equals"; | ||
}; | ||
const useUnmount = (fn) => { | ||
const fnRef = useRef(fn); | ||
fnRef.current = fn; | ||
const effect = () => () => fnRef.current(); | ||
useEffect(effect, []); | ||
}; | ||
const useWatch = (state, callback) => { | ||
@@ -1036,6 +1042,6 @@ const [prevState, setPrevState] = useState(state); | ||
}); | ||
return () => { | ||
props.onDestroy && props.onDestroy(); | ||
}; | ||
}, [onReady, props]); | ||
useUnmount(() => { | ||
props.onDestroy && props.onDestroy(); | ||
}); | ||
const onResize = useMemo(() => props.onResize, [props.onResize]); | ||
@@ -1042,0 +1048,0 @@ const handleResize = useCallback(() => { |
{ | ||
"name": "@awey/react-chart-container", | ||
"description": "A chart container component that can be used to wrap various charts. It will handle 'init ', 'update', and 'resize' of chart appropriatly.", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"type": "module", | ||
@@ -6,0 +6,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
135569
3307