LP#1765444: improve how MARC editor fetches fixed field metadata user/cesardv/gmcharlt_lp1765444_marc_editor_ff_init-signoff
authorGalen Charlton <gmc@equinoxinitiative.org>
Thu, 19 Apr 2018 15:44:42 +0000 (11:44 -0400)
committerCesar Velez <cesar.velez@equinoxinitiative.org>
Thu, 19 Apr 2018 20:52:08 +0000 (16:52 -0400)
commit1c039401d20a5e77c2f970bd529457c6aad693e4
treeeb54347f4dc16205dd0098f4ed76106e7cdb47cf
parent3a3cbc988c5431a1875397e9470ecf8025fa9e6b
LP#1765444: improve how MARC editor fetches fixed field metadata

This patch fixes a problem where the web staff MARC editor would
make repeated and redundant calls to two Evergreen methods to fetch
data about fixed field positions and values if that metadata was
not already cached by local storage or Hatch.

In particular, this patch caches and returns the data retrieval
promises, ensuring that only one set of FF position and value
requests are made.

Prior to this patch, each eg-marc-edit-fixed-field directive, of which
there are 64, could end up invoking those methods when initializing
the editor for a record type that had not been previously seen.

To test
-------
[1] Clear all FFPosTable_* and FFValueTable_* keys from local storage
    (or Hatch).
[2] Retrieve a bib record in the web staff client. Note that up to
    64 calls each are made of open-ils.cat.biblio.fixed_field_values.by_rec_type
    and open-ils.fielder.cmfpm.atomic.
[3] Apply the patch and repeat steps #1 and #2.
[4] This time, note that only one call each are made.
[5] Verify that the fixed field inputs continue to work as expected.

Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Cesar Velez <cesar.velez@equinoxinitiative.org>
Open-ILS/web/js/ui/default/staff/cat/services/tagtable.js