Skip to content

Duplicate onModelChange listeners #504

@waynewee

Description

@waynewee

Describe the bug

I'm rendering a FlexLayout that receives props from a parent component after initial render. As a result componentDidMount and componentDidUpdate are called before the FlexLayout is displayed.

In componentDidMount, the onModelChange listener is added and then in componentDidUpdate, it is added once more even though previousModel is undefined.

This results in two onModelChange listeners that result in the callback function attached firing twice every time a change is detected. Is this a problem with an implementation or a bug?

Your Example Website or App

No response

Steps to Reproduce the Bug or Issue

  1. Initialize a FlexLayout
  2. Update a property
  3. Attach the onModelChange callback
  4. Do an action that results in a model change (selecting a tab)
  5. Observe that the callback is fired twice

Expected behavior

  1. Callback is fired once

Operating System

Browser Type?

Browser Version

Screenshots or Videos

Can't upload due to company policy

Additional context

No response

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