Git Product home page Git Product logo

Comments (6)

komaedaXnagito avatar komaedaXnagito commented on August 21, 2024

示例代码,模拟用户输入带来的重新渲染,实际场景中存在需要用户填写大量数据的场景,用户反馈越填写页面越卡。实际上用户填写的内容并没有涉及到concent中相关的state或是effect等内容。使用示例代码可以发现页面刷新肉眼可见变慢,然后卡死抛出异常。去掉useConcent相关代码对比可以发现渲染没有变慢。concent版本2.4.0,2.4.4,2.4.18均可复现
const iState = () => ({ show: true, cool: 1, good: 2 });
function CcFnComp() {
const { state, syncBool } = useConcent({
module: "counter",
state: iState
});
const [value,setValue] = React.useState([{v:0,id:0},{v:0,id:1}])
const xxx = value[0].v;
React.useEffect(()=>{
setTimeout(()=>{
const newValue = [...value];
if(xxx.length>20){
newValue[0].v = 'reset'
}else{
newValue[0].v = xxx+"0";
}
setValue(newValue);
},10)
},[xxx])
return (


{xxx}

);
}

from helux.

fantasticsoul avatar fantasticsoul commented on August 21, 2024

你好,请给出具体的实例代码,或者在codesandbox创建一个实例并发送链接在issue,方便我跟踪和定位问题,或者分析你的代码本身可能有问题。

你的第二个答复里这段代码完全看不出什么问题, 第一个答复里明显是由死循环了。

from helux.

komaedaXnagito avatar komaedaXnagito commented on August 21, 2024

https://codesandbox.io/s/determined-johnson-7htdt?file=/src/App.js

from helux.

komaedaXnagito avatar komaedaXnagito commented on August 21, 2024

你好,请给出具体的实例代码,或者在codesandbox创建一个实例并发送链接在issue,方便我跟踪和定位问题,或者分析你的代码本身可能有问题。

你的第二个答复里这段代码完全看不出什么问题, 第一个答复里明显是由死循环了。

https://codesandbox.io/s/determined-johnson-7htdt?file=/src/App.js
循环只是为了模拟用户输入导致的重新渲染,改成input输入上百字符一样会出问题。

from helux.

fantasticsoul avatar fantasticsoul commented on August 21, 2024

2.4.19已修复,通过对比实例记录的模块版本号和store记录的模块版本号,来避免冗余的merge mstate操作,从而杜绝频发的ob state set操作导致的 Maximum call stack size exceeded
见在线示例
https://codesandbox.io/s/happy-bird-rc1t7?file=/src/App.js

from helux.

fantasticsoul avatar fantasticsoul commented on August 21, 2024

最后推荐如果使用了cocnent,可以用 ctx.effect替代原始的生命周期函数

from helux.

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.