@kodiak-finance/orderly-ui 2.10.0-alpha.6 → 2.10.0-alpha.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -10395,7 +10395,7 @@ var TabPanel = (props) => {
10395
10395
  const { title, value, icon, style, testid, children, className, classNames } = props;
10396
10396
  const { registerTab, unregisterTab } = React78.useContext(TabsContext);
10397
10397
  React78.useEffect(() => {
10398
- const tabConfig = {
10398
+ registerTab({
10399
10399
  title,
10400
10400
  value,
10401
10401
  icon,
@@ -10404,12 +10404,15 @@ var TabPanel = (props) => {
10404
10404
  classNames,
10405
10405
  style,
10406
10406
  content: children
10407
- };
10408
- registerTab(tabConfig);
10409
- return () => {
10410
- unregisterTab(tabConfig);
10411
- };
10407
+ });
10412
10408
  }, [children, style, icon, testid, title, value, className, classNames]);
10409
+ const lastValueRef = React78.useRef(value);
10410
+ React78.useEffect(() => {
10411
+ lastValueRef.current = value;
10412
+ }, [value]);
10413
+ React78.useEffect(() => {
10414
+ return () => unregisterTab({ value: lastValueRef.current });
10415
+ }, [unregisterTab]);
10413
10416
  return null;
10414
10417
  };
10415
10418
  if (process.env.NODE_ENV !== "production") {