RubyLouvre / anu

the React16-compat library with hooks

Home Page:https://rubylouvre.github.io/anu/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

thisTom opened this issue · 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 #1183 (comment) 被关闭了。线上问题 ,希望得到帮助,可以尽快回复

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

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

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

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

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

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

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

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

还没发版本么?

已经发了

还没有好吗

你要删掉本地的ReactBu