alibaba / alibaba/hooks

[useRequest] React18 StrictMode下,数据共享不生效

Open
#2,591 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
15k
Forks
2.8k
Avg merge
15h 7m
Merged PRs (30d)
2

Description

使用官方的[demo](https://ahooks.js.org/zh-CN/hooks/use-request/cache#%E6%95%B0%E6%8D%AE%E5%85%B1%E4%BA%AB),将react改为18并添加StrictMode

![20240710100817_rec_](https://github.com/alibaba/hooks/assets/31235016/b28cb00a-26e7-4238-a9b0-c3b1dfb1ae85)

[codesandbox](https://codesandbox.io/p/sandbox/infallible-galois-wpjhfw?file=%2Fpackage.json%3A13%2C2&layout=%257B%2522sidebarPanel%2522%253A%2522EXPLORER%2522%252C%2522rootPanelGroup%2522%253A%257B%2522direction%2522%253A%2522horizontal%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522id%2522%253A%2522ROOT_LAYOUT%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522clyf6dimf00063j6ltffdzx5r%2522%252C%2522sizes%2522%253A%255B100%252C0%255D%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522EDITOR%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522id%2522%253A%2522clyf6dime00023j6l1mpzl4mx%2522%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522SHELLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522id%2522%253A%2522clyf6dime00033j6ls0e3mrn1%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522DEVTOOLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522id%2522%253A%2522clyf6dime00053j6lmgdissb5%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%252C%2522sizes%2522%253A%255B50%252C50%255D%257D%252C%2522tabbedPanels%2522%253A%257B%2522clyf6dime00023j6l1mpzl4mx%2522%253A%257B%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clyf6dimd00013j6ltykzpr86%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522FILE%2522%252C%2522filepath%2522%253A%2522%252Findex.html%2522%252C%2522state%2522%253A%2522IDLE%2522%257D%252C%257B%2522id%2522%253A%2522clyf6eigf003d3j6lea79ijrk%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522FILE%2522%252C%2522initialSelections%2522%253A%255B%257B%2522startLineNumber%2522%253A13%252C%2522startColumn%2522%253A17%252C%2522endLineNumber%2522%253A13%252C%2522endColumn%2522%253A17%257D%255D%252C%2522filepath%2522%253A%2522%252Findex.tsx%2522%252C%2522state%2522%253A%2522IDLE%2522%257D%252C%257B%2522id%2522%253A%2522clyf6mz5g00023j6ln5jr6nuh%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522FILE%2522%252C%2522initialSelections%2522%253A%255B%257B%2522startLineNumber%2522%253A13%252C%2522startColumn%2522%253A2%252C%2522endLineNumber%2522%253A13%252C%2522endColumn%2522%253A2%257D%255D%252C%2522filepath%2522%253A%2522%252Fpackage.json%2522%252C%2522state%2522%253A%2522IDLE%2522%257D%255D%252C%2522id%2522%253A%2522clyf6dime00023j6l1mpzl4mx%2522%252C%2522activeTabId%2522%253A%2522clyf6mz5g00023j6ln5jr6nuh%2522%257D%252C%2522clyf6dime00053j6lmgdissb5%2522%253A%257B%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clyf6dime00043j6lb0zp9n8s%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522UNASSIGNED_PORT%2522%252C%2522port%2522%253A0%252C%2522path%2522%253A%2522%252F%2522%257D%255D%252C%2522id%2522%253A%2522clyf6dime00053j6lmgdissb5%2522%252C%2522activeTabId%2522%253A%2522clyf6dime00043j6lb0zp9n8s%2522%257D%252C%2522clyf6dime00033j6ls0e3mrn1%2522%253A%257B%2522tabs%2522%253A%255B%255D%252C%2522id%2522%253A%2522clyf6dime00033j6ls0e3mrn1%2522%257D%257D%252C%2522showDevtools%2522%253Atrue%252C%2522showShells%2522%253Afalse%252C%2522showSidebar%2522%253Atrue%252C%2522sidebarPanelSize%2522%253A15%257D)

Contributor guide

Open the contributing guide

Research direction

Start with the official useRequest cache data-sharing demo and the linked CodeSandbox, reproducing it with React 18 and StrictMode. Compare the observed behavior with the expected data sharing, then verify that data sharing works under StrictMode and add regression coverage if the repository's tests provide a suitable entry point.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.