Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加缓存后,setState 偶尔会失效 #9

Open
promise96319 opened this issue Jan 3, 2023 · 3 comments
Open

添加缓存后,setState 偶尔会失效 #9

promise96319 opened this issue Jan 3, 2023 · 3 comments

Comments

@promise96319
Copy link

demo 地址:https://stackblitz.com/edit/react-ts-ve5dk5?file=index.tsx,App.tsx,style.css

这个 demo 放到 stackblitz 里的时候刷新界面点击【切换可见状态】按钮是正常的。但是在 create-react-app 新建的项目中会产生问题。

问题复现:

  1. 使用 create-react-app 创建一个新的项目,react 版本为 18+,将 demo 代码替换到新建项目中。
  2. 运行后,点击【切换可见状态】按钮设置 visible 状态,偶尔会出现状态设置失效的情况(偶发性很高)。
  3. 刷新界面后,再次点击【切换可见状态】按钮,visible 设置失效。而且无法恢复,尝试重新运行也是有概率无法恢复。

2023-01-03 18 27 30

@shenjunru
Copy link
Owner

你给的例子,我这运行时好的啊
切换可见状态 也并不受keep-alive控制

@shenjunru
Copy link
Owner

并不清楚CRA里带里啥

@promise96319
Copy link
Author

promise96319 commented Jan 4, 2023

并不清楚CRA里带

好像是打断点调试然后刷新界面出现这个问题的,不打断点能正常运行,暂时定位不到哪出的问题,很奇怪。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants