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

[Bug] useRef 莫名丢失透传参数,memo失效 #362

Open
fantasticsoul opened this issue Nov 18, 2023 · 2 comments
Open

[Bug] useRef 莫名丢失透传参数,memo失效 #362

fantasticsoul opened this issue Nov 18, 2023 · 2 comments

Comments

@fantasticsoul
Copy link
Contributor

fantasticsoul commented Nov 18, 2023

最近在做一个集atomsignaldep collection为一体的状态库helux,目标是适配所有类 react 框架,目前 react 自身和preact 适配都完美运行,但适配fre时目前遇到两个怪问题,均可以从下面3个链接对比发现问题

react 演示链接:https://codesandbox.io/s/helux-react-starter-ts-539scq
preact 演示链接:https://codesandbox.io/s/helux-preact-starter-dnyzpy
fre 演示链接:https://codesandbox.io/s/helux-fre-starter-js-lqw4nc

1 useRef 莫名丢失透传参数

访问上述fre 演示链接,选择 Signal 然后点击 changeAtom,第一次正常,第二次报错
image
报错截图如下
image
useInsCtx内部用到了useRef,useRef 第二次调用莫名丢失透传参数(注:此例子 reactpreact 均正常)

注:此例子 reactpreact 均正常,可访问上述preact 或 react 演示链接选择 Signal 然后多次点击 changeAtom

2 memo失效

访问上述fre 演示链接,选择 ListCase 然后按下图所示操作 12 3 步骤,多添加几个 ListItem 后,挑选其中一个点击 changeName
image
可发现所有子项的update at 变化了,说明都在更新
image

注:此例子 reactpreact 均正常,可访问上述 preact 或 react 演示链接选择 ListCase 然后做同样操作,不会全部更新 ListItem

@ryouaki
Copy link
Contributor

ryouaki commented Dec 1, 2023

目前发布的fre版本里面的useContext和createContext实现有问题。直接去源码里面考呗useContext里面的实现。用那个就ok了

@yisar
Copy link
Collaborator

yisar commented Dec 2, 2023

你们好烦,别整fre了,俺暂时不维护了……fre只是测试跑得过,但是没有生产验证,别管fre了先

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

3 participants