Skip to content

Change to attribute passed to child does not trigger update #918

@cuberoot

Description

@cuberoot

I have a case where I have a parent LitElement component which renders a child LitElement component. I am trying to propagate a property to the child element. The change to the parent property comes from an outside source, but I am calling requestUpdate on the parent component.

The property is passed to the child component. And, the child component's attributeChangedCallback callback is called and LitElement does detect it. However, the child component's render is never called in response to the update. If I manually call requestUpdate on the child component from the console, the component updates correctly.

Live Demo

https://codesandbox.io/s/litelement-attribute-propigation-yw02g

Steps to Reproduce

See live demo above.

After a 5s delay, the parent component set's its own authToken property and calls requestUpdate. You can see that the child component does not update in response.

App: has token
Child: no token

Expected Results

I would expect the child component to re-render in response to the change to one of its attributes. The output should say.

App: has token
Child: has token

Actual Results

Child component does not re-render and you get the output

App: has token
Child: no token

Browsers Affected

  • Chrome
  • Firefox
  • Edge
  • Safari 11
  • Safari 10
  • IE 11

Versions

  • lit-element: v2.2.1

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