1. Bitbucket
  2. Public Issue Tracker
  3. master
  4. Issues


Issue #10280 resolved

Broken UI because of JS exception (BB-11299)

created an issue

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:

], function (
) {

    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 :)

Comments (5)

  1. Paolo reporter

    Here's some screenshots of the problem and client-side temporary fix.

    The top right dropdown doesn't work, and the console shows the exception:

    Screen Shot 2014-08-22 at 10.58.02.png

    I break on the var statement above the offending code, and create the hierarchy of objects the offending code wants:

    Screen Shot 2014-08-22 at 10.59.01.png

    Resume the JS and now the exception doesn't fire, and the UI code runs, so the dropdown works too:

    Screen Shot 2014-08-22 at 10.59.18.png

  2. Log in to comment