Api4Ctrl - Fix infinite reloads
authorTim Otten <totten@civicrm.org>
Wed, 7 Aug 2019 22:00:26 +0000 (15:00 -0700)
committerCiviCRM <info@civicrm.org>
Wed, 16 Sep 2020 02:13:18 +0000 (19:13 -0700)
commit6f8b6c684b60dce066c7e5bc488f9bde9688d53e
tree9686ed6894c68495094cc6a4b72f41ace180d04f
parent210888c516200c0f298000ecbe5ff70e78c9fcfe
Api4Ctrl - Fix infinite reloads

I noticed that the `afform-html` GUI is sending an infinite number requests to
reload its data.  After bisecting, I found that e7ebc633a had expanded the
scope the `watch()` so that it reloads on *any* change to `affApi4Ctrl` (not
just a change in params).  But the `affApi4Ctrl` includes the `.result` data
- as soon as the result data is returned, it re-triggers the watch and sends
the request again.  This becomes an infinite loop.

I don't think this was necessary for the goal of indexing - although maybe
the idea was that a change to `.index` should cause a reload, which seems
reasonable.  So I've whitelisted fields which deal with APIv4 inputs.
ext/afform/core/ang/afformCore/Api4Ctrl.js