@recharts/devtools 0.0.6 → 0.0.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.
@@ -25,7 +25,7 @@ const isValidInspectorKey = (key) => {
25
25
  return key != null && key in INSPECTORS;
26
26
  };
27
27
  function useSelectedInspector() {
28
- const [selectedInspectorId, setSelectedInspectorId] = useSessionStorageState('useChartWidth | useChartHeight');
28
+ const [selectedInspectorId, setSelectedInspectorId] = useSessionStorageState('selectedRechartsDevtoolsInspector', 'useChartWidth | useChartHeight');
29
29
  const selectedInspector = INSPECTORS[selectedInspectorId];
30
30
  if (!selectedInspector) {
31
31
  setSelectedInspectorId('useChartWidth | useChartHeight');
@@ -47,7 +47,7 @@ export const RechartsDevtools = () => {
47
47
  }
48
48
  }
49
49
  }, [portalId, setSelectedInspectorId]);
50
- const [isOverlayEnabled, setIsOverlayEnabled] = useSessionStorageState(false);
50
+ const [isOverlayEnabled, setIsOverlayEnabled] = useSessionStorageState('rechartsDevtoolsOverlayEnabled', false);
51
51
  if (!container || !selectedInspector) {
52
52
  return null;
53
53
  }
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * This hook works just the same as `useState`, but it also stores the state in the session storage.
3
- * It uses `useId` from React to generate a unique key for the state.
4
3
  *
5
4
  * In browsers without session storage support, it will fallback to `useState`.
6
5
  */
7
- export declare const useSessionStorageState: <T>(initialState: T) => readonly [any, import("react").Dispatch<any>];
6
+ export declare const useSessionStorageState: <T>(id: string, initialState: T) => readonly [any, import("react").Dispatch<any>];
@@ -1,12 +1,10 @@
1
- import { useId, useState, useEffect } from "react";
1
+ import { useState, useEffect } from 'react';
2
2
  /**
3
3
  * This hook works just the same as `useState`, but it also stores the state in the session storage.
4
- * It uses `useId` from React to generate a unique key for the state.
5
4
  *
6
5
  * In browsers without session storage support, it will fallback to `useState`.
7
6
  */
8
- export const useSessionStorageState = (initialState) => {
9
- const id = useId();
7
+ export const useSessionStorageState = (id, initialState) => {
10
8
  const [state, setState] = useState(() => {
11
9
  try {
12
10
  const storedState = sessionStorage.getItem(id);
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "type": "module",
7
- "version": "0.0.6",
7
+ "version": "0.0.7",
8
8
  "description": "Devtools and helper functions for Recharts",
9
9
  "main": "dist/index.js",
10
10
  "types": "dist/index.d.ts",