stable

Clone or download

Read-only

fix: clash between list picker and field dependencies

Problem ------- Given (see example structure in attachment): * a field `Field 1` * with `a` as (default) value * only submitable, no update permissions * a field `Field 2` * with `d, e` as values * submitable & updatable * a field `Field 3` * with `g, h` as values * submitable & updatable * the following field dependencies matrix: * `Field 1(a)` ➡ī¸ `Field 2(d, e)` * `Field 2(d)` ➡ī¸ `Field 3(g)` * `Field 2(e)` ➡ī¸ `Field 3(h)` When users try to submit an artifact, then field dependencies are not propagated: choosing `Field 2(d)` or `Field 2(e)` does not change anything for `Field 3`. ☚ī¸ Note: everything is fine at the update of the artifact though. Analysis -------- * Everything works pretty fine if ListPicker is disabled. * In artifact edition, only field dependencies are initialised at page load. ListPicker is initialised only when the fields enters in edition. * If we defer the initialisation of field dependencies so that they initially run after the initialisation of ListPicker, then all is back to normal. * Event soup: both ListPicker and field dependencies listen to `change` event and manipulate the native `<select>` element. Conclusion: I don't know exactly where, but it appears that at some point there is a race condition between ListPicker and field dependencies initialisations. Solution -------- The field dependencies initialisation is now run **after** the load of ListPicker. This is done everywhere field dependencies are applied: * submit, * edit, * copy, * masschange, * artifact modal v1 (in artifact link -> create artifact) --- Closes request #23051: Field dependencies issue at artifact creation Change-Id: If0f6a910e52069bd30a1df25892e557a3aa32748

Modified Files

Name
M plugins/tracker/include/Tracker/Artifact/Renderer/CopyRenderer.class.php +3 −2 Go to diff View file
M plugins/tracker/include/Tracker/Artifact/Renderer/EditRenderer.class.php +2 −2 Go to diff View file
A plugins/tracker/include/Tracker/Artifact/Renderer/ListFieldsIncluder.php +38 −0 Go to diff View file
M plugins/tracker/include/Tracker/Artifact/Renderer/SubmitOverlayRenderer.class.php +2 −2 Go to diff View file
M plugins/tracker/include/Tracker/Artifact/Renderer/SubmitRenderer.class.php +2 −3 Go to diff View file
M plugins/tracker/include/Tracker/FormElement/Tracker_FormElement_Field_List.php +1 −1 Go to diff View file
M plugins/tracker/include/Tracker/Tracker.class.php +2 −2 Go to diff View file
A plugins/tracker/scripts/artifact/run-field-dependencies.ts +36 −0 Go to diff View file
M plugins/tracker/scripts/legacy/TrackerFieldDependencies.js +0 −2 Go to diff View file
M plugins/tracker/webpack.common.js +1 −0 Go to diff View file