Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.0.6 useEffect 依赖为空数组时,页面卸载return函数不执行 #7206

Closed
lf7817 opened this issue Jul 30, 2020 · 2 comments · Fixed by #7221 or #7257
Closed

3.0.6 useEffect 依赖为空数组时,页面卸载return函数不执行 #7206

lf7817 opened this issue Jul 30, 2020 · 2 comments · Fixed by #7221 or #7257
Labels
F-react Framework - React P-1 High, patch T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Milestone

Comments

@lf7817
Copy link
Contributor

lf7817 commented Jul 30, 2020

相关平台

微信小程序

复现仓库

https://github.com/lf7817/taro-test
小程序基础库: 2.9.5
使用框架: React

复现步骤

const Test: FC = () => {

  useEffect(() => {
    console.log('mount')
    return () => {
      console.log('unmount')
    }
  }, [])

  return (
    <View className='index'>
      <Text>Hello world!</Text>
    </View>
  )
}

期望结果

页面挂载时打印mount
页面卸载时打印unmount

实际结果

页面挂载时打印了mount
页面卸载时未打印unmount

环境信息

Taro CLI 3.0.6 environment info:
    System:
      OS: Windows 10
    Binaries:
      Node: 12.18.2 - C:\Program Files\nodejs\node.EXE
      Yarn: 1.22.4 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
      npm: 6.14.5 - C:\Program Files\nodejs\npm.CMD
@taro-bot2 taro-bot2 bot added F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x labels Jul 30, 2020
@lf7817
Copy link
Contributor Author

lf7817 commented Jul 30, 2020

3.0.5版本正常

@FredZeng
Copy link

FredZeng commented Aug 1, 2020

3.0.6 版本,普通的 class 组件,unmount 事件也没触发

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React P-1 High, patch T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants