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>
Wed, 3 Dec 2014 17:58:51 +0000 (12:58 -0500)
commita319667fb6afceeea98d0011f8036217f3e76f41
tree2c7cccf3479c6afcb857804c171107b966b2197c
parent3c401292c0c11aea624f81313b5b843bf5ea9ea3
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