GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — watch on array does not work correctly · Issue #8 · astamuse/asta4js

watch on array does not work correctly #8

New issue
Copy link
New issue
Copy link
Open
Open
watch on array does not work correctly#8
Copy link
Labels
bug

Description

@xzer
xzer
opened on Dec 24, 2015
Issue body actions

If we watch to a existing array and then add items to the existing array, the watch function will not work correctly:

  Aj.init(function ($scope) {

    $scope.data = {
      list: []
    };

    $scope.snippet("ul").bind($scope.data, {
      list:{
        _duplicator: "li",
        _item: {
          "nnn": {
            _selector: ".x-watch",
            _watch: {
              _fields: ["name"],
              _cal: function(v){
                console.log("cal", v);
                return v+"-watched";
              }
            },
            _render: function(target, nv, ov, ctx){
              console.log("args", arguments);
              console.log("idx:", ctx.getArrayAssistant().getIndex());
              target.text(nv);
            }
          }
        }
      }
    });

    $scope.data.list.push({
      name: "name-" + i
    });
}

Workaround is to reassign a new array reference to replace the existing array:

    $scope.data.list = Aj.util.clone($scope.data.list);
    $scope.data.list.push({
      name: "name-" + i
    });

Activity

  1. xzer
    added a commit that references this issue on Dec 24, 2015

    add reproduce case for #8

    b229898
  2. xzer commented on Dec 24, 2015

    @xzer
    xzer
    on Dec 24, 2015
    MemberAuthor
    More actions

    Currently, I confirmed that it registered the observer correctly, and the watch result is assigned to the watch result value holder correctly, but the corresponding observer is not invoked.

    There may be something I missed or there is a bug in polymer/observe

  3. xzer
    added
    bug
    on Dec 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402792 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.