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

fix bug with cache objects changed in react #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cevio
Copy link

@cevio cevio commented Sep 30, 2020

TypeClient 这个项目的bugfix阶段,我们发现你的逻辑并不严谨,会导致很多react组件渲染时候出现问题,所以,我们进行了修复并且同步给您。希望您能认真考虑后确认是否合并这个PR。

合并后,您的代码可能会有所变化,但是我们也兼容了老的写法:

const countState = useStore((store: Store) => ({
    count: store.count,
  }), [object1, object2, ...])

意思:当[object1, object2]数据有变化的时候,程序将自动stop销毁掉之前的effect引用,使用新的effect作为这次的引用。这类似于useMemo一样,之后第二个参数变化的时候,它的值才会变。

它的interface变为:

<T, S>(selector: Selector<T, S>, changes?: any[]): S;

@cevio cevio changed the title fix bug with unsafe object changes in react fix bug with cache object changes in react Oct 7, 2020
@cevio cevio changed the title fix bug with cache object changes in react fix bug with cache objects changed in react Oct 7, 2020
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

Successfully merging this pull request may close these issues.

None yet

1 participant