Skip to content

0.18+ not reloading function components #367

@brunolm

Description

@brunolm

0.18+

It's referencing the old (before code changes) component. It doesn't happen with klasses because they use a hash to ensure the most recent is being used.

  if (isFunction(node)) {
    const context = node.type.name ? scope.generateContext(node.attributes) : node.attributes
    const children = node.type(context)
    node.children = [].concat(children)
    for (let i = 0; i < node.children.length; i++) {
      await generateBranch(siblings, node.children[i], `${depth}-${i}`, scope)
    }
    return
  }

repro:

  1. create a class component (eg Application.jsx)
  2. create a function component (eg Hero.jsx) and import on Application
  3. Update Hero

expected

  • changes to show up

actual

  • no changes

if Hero is converted to a class it works as expected

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions