Coder Social home page Coder Social logo

enterFilter about react-keeper HOT 11 OPEN

lanistor avatar lanistor commented on August 15, 2024
enterFilter

from react-keeper.

Comments (11)

yueduz avatar yueduz commented on August 15, 2024

确实是会被调用两次,但是不清楚是什么原因.

from react-keeper.

yueduz avatar yueduz commented on August 15, 2024

2017-06-06 23-32-56
我在enterFilter里调用了这个函数

from react-keeper.

yueduz avatar yueduz commented on August 15, 2024

我使用了mobx,是不是因为在enterFilter调用时执行了一次,渲染好后检测到props变化又自动渲染了一次,但是我是在设置好props才调用的callback()啊,但是我看组件在没有完成props设置就渲染了一次了

from react-keeper.

lanistor avatar lanistor commented on August 15, 2024

filter只有在目标component 的mount状态改变的时候才会执行,可以通过render方法打印下,看是否mount状态有改变。

from react-keeper.

yueduz avatar yueduz commented on August 15, 2024

2017-06-07 21-48-42
确实是,render了一次,enterFilter了两次

from react-keeper.

lanistor avatar lanistor commented on August 15, 2024

@yueduz 可否提供下测试代码,我们这边调试一下?

from react-keeper.

yueduz avatar yueduz commented on August 15, 2024

我这里环境较复杂,不太方便. enterFilter在render前后各调用了一次

from react-keeper.

yueduz avatar yueduz commented on August 15, 2024

代码直接给你的话可能无法正常运行,如果不能运行也可以那我可以把代码给你

from react-keeper.

lanistor avatar lanistor commented on August 15, 2024

@yueduz 有能复现问题的代码就可以,不一定源代码。可以发我邮箱

from react-keeper.

yueduz avatar yueduz commented on August 15, 2024

我想我找到问题了,为什么刷新两次.组件还没有render()的时候调用了一次enterFilter,但是enterFilter改变了组件引用的值.,所以mobx刷新了组件,组件刷新自然又要调用enterFilter.第二次调用enterFilter设置的值和第一次一样,所以没有继续刷新.在还没有callback()之前,mobx就检测到引用变化了.不知道怎么解决

from react-keeper.

lanistor avatar lanistor commented on August 15, 2024

@yueduz 好的。我们这边进行下测试。

from react-keeper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.