alibaba / alibaba/hooks

ready为false的时候,仍然使用了缓存

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

Description

`
{
ready: !!blogId,
cacheKey: 'xxx-info'
}
`
用户列表进入用户详情页面,会根据返回的用户数据中是否有blogId请求该用户的最新一条博客内容,当我打开一个有blogId的用户并正常请求到博客内容(此时有cacheKey会缓存),然后离开该详情从列表打开一个没有blogId的用户详情,发现此时由于blogId为undefined,未发起接口请求(正常的),但是仍然使用了缓存的上个用户的数据,从到导致数据展示出错

Contributor guide

Open the contributing guide

Research direction

The issue names no file, test, or entry point, so first locate the user-list/user-detail hook that accepts ready and cacheKey, then reproduce the navigation from a user with blogId to one without it. Done means the second detail view makes no request and does not display the previous user's cached blog data; add or update a regression test for that sequence.

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
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.