Avoid org tree retrieval race condition on patron app
authorBill Erickson <berickxx@gmail.com>
Wed, 3 Dec 2014 17:48:12 +0000 (12:48 -0500)
committerMike Rylander <mrylander@gmail.com>
Wed, 3 Dec 2014 21:58:15 +0000 (16:58 -0500)
commit9f4e78e209bda06eb673d332bd065b9b1e977e47
tree61bc5d197c6bb8ee51cf03626790cccde1ea8acc
parent298b1ef3645027b94eefb60302d092b320896c2e
Avoid org tree retrieval race condition on patron app

Avoid calling egOrg.ancestors() during startup, because the org unit
tree is not guarantee to be available until startup has completed.  This
was causing an occasional JS excpetion in the patron app pages, which
prevented the pages from loading.

The error in question:

 TypeError: Cannot read property 'map' of undefined
    at Object.service.get (https://host/js/ui/default/staff/services/org.js:21:25)
    at Object.service.ancestors (https://host/js/ui/default/staff/services/org.js:34:28)
    at Object.egCore.env.classLoaders.actsc (https://host/js/ui/default/staff/circ/patron/app.js:41:37)
    at https://host/js/ui/default/staff/services/env.js:77:55
    at Object.r [as forEach] (https://host/js/ui/default/staff/build/js/angular.min.js:7:290)
    at Object.service.load (https://host/js/ui/default/staff/services/env.js:76:17)
    at https://host/js/ui/default/staff/services/startup.js:64:23
    at J (https://host/js/ui/default/staff/build/js/angular.min.js:101:96)
    at https://host/js/ui/default/staff/build/js/angular.min.js:102:259
    at h.$eval (https://host/js/ui/default/staff/build/js/angular.min.js:113:32)

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/web/js/ui/default/staff/circ/patron/app.js