Skip to content

Commit 466571c

Browse files
author
blucas.wu
committed
feat: refresh storage in useEffect
1 parent 38bd6d9 commit 466571c

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
},
1818
"devDependencies": {
1919
"@babel/eslint-parser": "^7.19.1",
20-
"@huolala-tech/page-spy": "^1.3.1",
20+
"@huolala-tech/page-spy": "^1.3.2",
2121
"@mdx-js/rollup": "^2.3.0",
2222
"@types/lodash-es": "^4.17.7",
2323
"@types/mdx": "^2.0.4",

src/pages/Devtools/StoragePanel/index.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { SpyStorage } from '@huolala-tech/page-spy';
22
import { Button, Col, Layout, Menu, Row, Table, Tooltip } from 'antd';
3-
import { useMemo, useState } from 'react';
3+
import { useEffect, useMemo, useState } from 'react';
44
import ReactJsonView from '@huolala-tech/react-json-view';
55
import './index.less';
66
import { useSocketMessageStore } from '@/store/socket-message';
@@ -18,6 +18,12 @@ export const StoragePanel = () => {
1818
state.storageMsg,
1919
state.refresh,
2020
]);
21+
useEffect(() => {
22+
refresh('localStorage');
23+
refresh('sessionStorage');
24+
refresh('cookie');
25+
// eslint-disable-next-line react-hooks/exhaustive-deps
26+
}, []);
2127
const [activeTab, setActiveTab] =
2228
useState<SpyStorage.DataType>('localStorage');
2329
const data = useMemo(() => {

yarn.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -746,10 +746,10 @@
746746
"@huolala-tech/page-spy-api-win32-arm" "1.2.2"
747747
"@huolala-tech/page-spy-api-win32-arm64" "1.2.2"
748748

749-
"@huolala-tech/page-spy@^1.3.1":
750-
version "1.3.1"
751-
resolved "https://registry.npmjs.org/@huolala-tech/page-spy/-/page-spy-1.3.1.tgz#0a50c36b65665692d026d82bc2d31de7dc2a7bf2"
752-
integrity sha512-w+iu/jQBpzp+JuL4zgeVumym+Yax7jCVyg3Hbko1s8W5g7HM3Y3BGZ69mhR5/R4uIWZTD5d00HUcAcCLUXE+AA==
749+
"@huolala-tech/page-spy@^1.3.2":
750+
version "1.3.2"
751+
resolved "https://registry.npmjs.org/@huolala-tech/page-spy/-/page-spy-1.3.2.tgz#442ae3d345d77c06bb6f9c0565e79fb47a842fbc"
752+
integrity sha512-7NrFnWObZkeU47HR+Kb+sh7XDae/k4fpLM77X6/WBRbJlVMzhVLfxqKr4a+XvYxH67pxpKG3WyVKzf5V175LcQ==
753753
dependencies:
754754
"@babel/runtime" "^7.13.0"
755755
copy-to-clipboard "^3.3.1"

0 commit comments

Comments
 (0)