Uploaded image for project: 'Appcelerator - INBOX'
  1. Appcelerator - INBOX
  2. AC-6181

$.destroy undefined exception on Collection callback

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Invalid
    • Affects Version/s: None
    • Component/s: Alloy
    • Labels:
      None
    • Environment:

      AppC CLI 7.0.10
      TiSDK 7.5.1.GA, Alloy 1.13.9
      MacOS 10.14.2

      Description

      I have two instanced Collections in one of my Views with data binding. I have the close of the view hooked up to a cleanup function which calls '$.destroy'. Whenever that destroy function is thrown I get an undefined exception Uncaught ReferenceError: __alloyId488 is not defined. In the alloy code, I see that id is the callback to my collection, but I'm unsure of what could be happening to it. I'm only doing a reset on the collection once I get data back from a request.

          var __alloyId487 = Alloy.Collections['$.Experts'] || $.Experts;
       
      function __alloyId488(e) {
          if (e && e.fromAdapter) {
              return;
          }
          var opts = __alloyId488.opts || {};
          var models = __alloyId487.models;
          var len = models.length;
          var __alloyId483 = [];
          for (var i = 0; i < len; i++) {
              var __alloyId484 = models[i];
              __alloyId484.__transform = TF.transformExpert(__alloyId484);
              var __alloyId486 = {
                  properties: {
                      backgroundColor: "transparent",
                      selectedBackgroundColor: Alloy.CFG.design.colors.primary,
                      itemId: __alloyId484.__transform.expertusername
                  },
                  expHeader: {
                      text: 'Preferred ' + __alloyId484.__transform.field + ' Expert'
                  },
                  expImg: {
                      image: __alloyId484.__transform.prefImage
                  },
                  expName: {
                      text: __alloyId484.__transform.expertname
                  },
                  expCompany: {
                      text: __alloyId484.__transform.company
                  },
                  expPhone: {
                      text: __alloyId484.__transform.expert_ph1
                  },
                  expEmail: {
                      text: __alloyId484.__transform.expert_email
                  },
                  expWeb: {
                      text: __alloyId484.__transform.webAddress
                  },
                  template: "expertCard"
              };
              __alloyId483.push(__alloyId486);
          }
          opts.animation ? $.__views.expSection.setItems(__alloyId483, opts.animation) : $.__views.expSection.setItems(__alloyId483);
      };
      __alloyId487.on('fetch destroy change add remove reset', __alloyId488);
      }
      __alloyId482.push($.__views.expSection);
      $.__views.propSection = Ti.UI.createListSection({
          backgroundColor: "transparent",
          id: "propSection"
      });
      

      Both collections are included in the XML as follows

      <Alloy>
          <Collection id="Properties" instance="true" src="Property" />
          <Collection id="Experts" instance="true" src="Expert" />
      

      I have tried multiple different 7.X sdk versions, as well as different appc CLI versions to see if it was an error with their specific bundled alloy version, but still received the error. Same even after checking out a previous commit of the project where I know the error didn't exist but just keeps cropping up.

      Completely reinstalled the cli and all my SDKs, but still getting the error. Hopefully commenting out the destroy and manually calling .off() on both Collections is enough of a workaround for now.

        Attachments

          Activity

            People

            • Assignee:
              shossain Shak Hossain
              Reporter:
              zlitten Zachary Litten
            • Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Git Source Code