Uploaded image for project: 'Bitbucket Cloud'
  1. Bitbucket Cloud
  2. BCLOUD-10280

Broken UI because of JS exception (BB-11299)

    XMLWordPrintable

Details

    Description

      Symptom: dropdowns not working, like the watching preferences on the top right of a repo page.

      Cause: a JS exception in opt-store.js on line 19 caused the code that handles these things to never run: Uncaught TypeError: Cannot read property 'state' of undefined opt-store.js:19

      This is the current opt-store.js:

      #!javascript
      
      define('utils/opt-store',[
        'jquery',
        'underscore',
        'data/current-user',
        'data/debug',
        'utils/preferences'
      ], function (
        $,
        _,
        currentUser,
        debug,
        preferences
      ) {
      
        var
          optimizely = window.optimizely,
          variationMap = {};
        if (!debug && typeof (optimizely) != 'undefined' && currentUser.isAuthenticated) {
          _.each(optimizely.data.state.activeExperiments, function (id) {
            var variation = optimizely.data.state.variationMap[id];
            preferences.set('optimizely-' + id, variation);
            variationMap[id] = variation;
          });
        }
        return variationMap;
      
      });
      
      

      The offending piece is optimizely.data.state.activeExperiments.

      Inspecting the window.optimizely object one findes that:

      • optimizely.activeExperiments exists and is an empty array ([])
      • the optimizely object has no other properties.

      I guess that this is the result of an API change or something similar, so the way to access the data from that object changed.

      One can get around this by putting a breakpoint to a previous line and creating the needed hierarchy of properties on the optimizely object, but it would be good for this to get fixed so one can just click on pieces of UI and have them work

      Attachments

        Activity

          People

            zdavis Zachary Davis (Inactive)
            eab85fe92daf bpaf
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: