Details
-
Bug
-
Resolution: Fixed
-
High
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