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

[BUG] render returns undefined to undefined empty nodes are also rebuilt #2329

Open
carlisliu opened this issue Mar 10, 2022 · 2 comments
Open
Labels

Comments

@carlisliu
Copy link
Contributor

carlisliu commented Mar 10, 2022

⌨️

Rax Core

Minimal code and steps to reproduce the bug

import { Component } from 'rax';

class UndefinedDemo extends Component {
  constructor(props) {
    super(props);

    this.state = {
      alwaysUndefined: false,
    };
  }

  render() {
    return (
      <div>
        {this.state.alwaysUndefined ? undefined : undefined}

        <button
          onClick={() => {
            this.setState({
              alwaysUndefined: !this.state.alwaysUndefined
            });
          }}
        >
          Switch
        </button>
      </div>
    )
  }
}

reference: fix: render returns null to null empty nodes are also rebuilt(#1830) #1842

shouldUpdateComponent method should also checkundefined type.

Current and expected behavior

current:
undefined node is rebuilt

expected:
undefined node is updated

Environment

Rax Version: 1.2.2

build.json

No response

Possible solution

No response

Additional context

No response

@carlisliu carlisliu added the Bug label Mar 10, 2022
@carlisliu carlisliu changed the title [BUG] <title> [BUG] render returns undefined to undefined empty nodes are also rebuilt Mar 10, 2022
@nick950222
Copy link

image

@SoloJiang
Copy link
Collaborator

The problem has been solved #2275

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants