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

fix(runtime): removeEventListener时组件不在componentsAlias引发报错 #16013

Open
wants to merge 2 commits into
base: 3.x
Choose a base branch
from

Conversation

liulinboyi
Copy link

PR信息

这个 PR 是什么类型? (至少选择一个)

这个 PR 涉及以下平台:

  • 所有小程序

最小复现

仓库
https://github.com/liulinboyi/taro-removeEventListener-bug

代码

import { View, Text } from '@tarojs/components'
import { useState } from 'react'

export default function Index() {
  const [flag, setFlag] = useState(true)

  return (
    <View className='index'>
      <View className='wrapper'>
        {
          flag ?
            <Text className='box' onClick={() => setFlag(prev => !prev)}>Demo {flag ? '1' : '0'}</Text> :
            <Text className='box'>Other {flag ? '1' : '0'}</Text>
        }
      </View>
    </View>
  )
}

上述代码编译后运行在微信小程序中时,点击Demo 1时,在控制台会抛出错误如下:

demo_bug

修复

修复后如下:

demo_bug_2

This was referenced Jul 6, 2024
@liqinuo liqinuo changed the base branch from main to 3.x July 16, 2024 06:50
@ZEJIA-LIU ZEJIA-LIU deleted the branch NervJS:3.x July 16, 2024 07:16
@ZEJIA-LIU ZEJIA-LIU closed this Jul 16, 2024
@ZEJIA-LIU ZEJIA-LIU reopened this Jul 16, 2024
This was referenced Aug 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants