GithubHelp home page GithubHelp logo

Comments (6)

SoonIter avatar SoonIter commented on August 25, 2024

如果是这样的话,initialState也要改为

initialState(){ 
   return {
          name:"",
          age:1
   }
}

from foca.

geekact avatar geekact commented on August 25, 2024

模型多的情况下确实可能出现这个问题。尤其是在RN这种把所有JS打包在一起的。

对于webpack或者vite打包的web项目则不存在这个问题,因为模型本身就是模块化的,支持代码分割,即自动分配到对应页面的chunk里了。

即用即创建,由于用户视口有限,同时在线的model的数量是很少的。

这是个很不错的建议,感谢你的付出。实现上我觉得应该让开发者无感知,getModel(userModel).state.name这种方式太繁琐,所有地方都要加,增加了开发者的心智负担。我觉得可以借鉴linux Copy on Write的思路,我们实现一种Register on Read的机制,即在部分属性入口自动判断是否需要注册。

from foca.

geekact avatar geekact commented on August 25, 2024

最近在完善node框架,所以应该会到9月才会开始升级

from foca.

geekact avatar geekact commented on August 25, 2024

昨晚实现了按需初始化模型的功能并发布了 1.3.0-next.0 版本,3342275 ,用户无感知,但仍需多测试一下,欢迎给予意见建议

from foca.

geekact avatar geekact commented on August 25, 2024

大概思路是在一些入口增加逻辑判断,比如执行actions(reducers)、获取state、使用useModel等。

from foca.

geekact avatar geekact commented on August 25, 2024

如今有了更好的选择,局部模型。 https://foca.js.org/#/advanced?id=%e5%b1%80%e9%83%a8%e6%a8%a1%e5%9e%8b

from foca.

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.