RubyLouvre / anu

the React16-compat library with hooks
https://rubylouvre.github.io/anu/
Apache License 2.0
3.19k stars 318 forks source link

百度小程序种3.105.17及以上调试基础库,子组件状态变化,不会触发不渲染更新。 #1184

Open thisTom opened 4 years ago

thisTom commented 4 years ago

bug描述 百度小程序种3.105.17及以上调试基础库,子组件状态变化,不会触发不渲染更新。

复现bug的步骤 nanachi init test (默认模板) cd test && npm i nanachi watch

pages index index.js替换为如下测试代码:

import React from '@react';
import Welcome from '@components/Welcome/index';
class P extends React.Component {
    constructor() {
        super();
        this.state = {
            name: 'name'
        }
    }
    render() {
        return (
            <div>
                <div>子组件问题:</div>
                <Welcome name={this.state.name} />
            </div>
        );
    }
    componentWillMount(){
        setTimeout(()=>{
            this.setState({name: 'new name'})
        }, 3000)

    }
}

export default P;

components Welcome index.js 替换为如下测试代码

import React from '@react';
class Welcome extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            name: props.name
        };
    }
    componentWillReceiveProps(props){
        console.log(props);
        this.setState({
            name: props.name
        });
    }
    render() {
        return (
            <h2>Hello, {this.state.name}.</h2>
        );
    }
}

export default Welcome;

将小程序调试基础库设置为3.105.17或更高版本。3.105.17及以下版本无异常。 问题截图 下图为3.105.17以下版本无异常截图 QQ截图20191112173921 下图为3.105.17及以下版本异常截图 QQ截图20191112173839

编译环境信息

运行环境信息

百度小程序官方建议排查https://smartprogram.baidu.com/forum/topic/show/70128,因为3.105.17有一个非兼容性更新。 上个BUG https://github.com/RubyLouvre/anu/issues/1183#issue-513275009 被关闭了。线上问题 ,希望得到帮助,可以尽快回复

thisTom commented 4 years ago

感谢,希望可以尽快得到回复

RubyLouvre commented 4 years ago

https://github.com/RubyLouvre/anu/tree/branch3/dist

使用这个试试。我们周五会发一版。

thisTom commented 4 years ago

https://github.com/RubyLouvre/anu/tree/branch3/dist

使用这个试试。我们周五会发一版。

非常感谢,分之三 解决了问题

thisTom commented 4 years ago

https://github.com/RubyLouvre/anu/tree/branch3/dist

使用这个试试。我们周五会发一版。

还没发版本么?

RubyLouvre commented 4 years ago

已经发了

RubyLouvre commented 4 years ago

还没有好吗

RubyLouvre commented 4 years ago

你要删掉本地的ReactBu