anu icon indicating copy to clipboard operation
anu copied to clipboard

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

Open thisTom opened this issue 4 years ago • 7 comments

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

编译环境信息

  • nanachi-cli 版本:1.0.9
  • nodejs版本、npm版本:[node v10+、npm 5.6.0]
  • 小程序IDE 版本: 2.15.3
  • 电脑操作系统: win10

运行环境信息

  • 端版本: 百度小程序开发工具2.15.3

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

thisTom avatar Nov 12 '19 10:11 thisTom

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

thisTom avatar Nov 12 '19 10:11 thisTom

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

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

RubyLouvre avatar Nov 13 '19 06:11 RubyLouvre

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

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

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

thisTom avatar Nov 13 '19 07:11 thisTom

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

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

还没发版本么?

thisTom avatar Nov 25 '19 12:11 thisTom

已经发了

RubyLouvre avatar Dec 05 '19 14:12 RubyLouvre

还没有好吗

RubyLouvre avatar Dec 05 '19 14:12 RubyLouvre

你要删掉本地的ReactBu

RubyLouvre avatar Dec 05 '19 14:12 RubyLouvre