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)
committerBill Erickson <berickxx@gmail.com>
Mon, 15 Dec 2014 19:14:03 +0000 (14:14 -0500)
commit8b6f4b5807e3a99f1cb849acaceefb1ebca4fda4
tree883aa223d12c387bf2ad70a8c0cb4611ec0b649d
parent21b6220b89c5f27452593200f8bea22cb2db33b2
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