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

Method observer on array property of element using MutableData is called twice on set. #5358

Closed
5 tasks
slindeneau opened this issue Sep 15, 2018 · 2 comments
Closed
5 tasks
Labels

Comments

@slindeneau
Copy link

slindeneau commented Sep 15, 2018

Description

Using a method observer that observers all related changes to path (ex: prop.* ) will cause the method observer to fire twice for the base property value on set.

ex:

    static get properties() {
        return {
            arrayData:{
              type:Array,
              notify:true
            }
        };
    }
    static get observers() {
      return [
        '_arrayObserver(arrayData.*)'
      ]
    }

The observer will be called twice

Live Demo

Polymer 3 live demos exist?

Used polymer demo as base, check out the demo/child-element and demo/demo-element
https://github.com/slindeneau/poly-observer-bug

Steps to Reproduce

  1. child-element has method observer on wildcard array mutation
  2. child-element uses the mixin MutableData
  3. child-element has a property that has notify: true
  4. parent-element uses two-way data binding to bind that property to one of its properties.
  5. child-element sets property value
  6. child-element method observer is called twice

Expected Results

Method observer is called once for the base element

Actual Results

Method observer is called twice for the base element

Browsers Affected

  • [ x] Chrome
  • Firefox
  • Edge
  • Safari 11
  • Safari 10
  • IE 11

Versions

@polymer/polymer@3.0.5
@webcomponents/webcomponentsjs@1.2.6

@stale
Copy link

stale bot commented Mar 13, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Mar 13, 2020
@stale
Copy link

stale bot commented Apr 17, 2022

This issue has been automatically closed after being marked stale. If you're still facing this problem with the above solution, please comment and we'll reopen!

@stale stale bot closed this as completed Apr 17, 2022
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

1 participant