Currently, if you use a wizard to edit an existing entity, the entity won't be in the tempstore until the "Next" button has been clicked at least once.
This is because the general model of the wizard is to not write to the tempstore until the form is submitted. For the most part this works, but if the first step (or the first step you jump to, because you can jump to any step in an edit form) opens a dialog (which isn't a step on the wizard but another form, so it pulls the cached values from the tempstore, rather than the form state temporary value), then the dialog won't have access to the entity to edit.
The way this manifests is you go to a step in the wizard, click an "Edit" link which is meant to open a dialog and nothing will happen. But if you press "Next" and then "Previous", clicking the "Edit" link will magically start working!
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | ctools-wizard-initialize-values-2619948-7.patch | 1018 bytes | dsnopek |
Comments
Comment #2
dsnopekHere is a patch that fixes it, by initializing the cached values and setting them in the tempstore when building the form, if the cached values aren't already set.
Comment #4
dsnopekWhoa, type-o! Not sure how this worked in my manual testing, but it's great that we have tests. :-)
Comment #5
dsnopekNeed to get feedback first on if this is OK, but if it is, this patch will need tests!
Comment #6
dsnopekNew patch that works for both edit and add!
Comment #7
dsnopekMoved up the call stack while hacking on it with EclipseGC.
Comment #8
eclipsegc commentedSuper sensible and fixes a long standing race condition I'd not yet tracked down. Thank you!
If you're going to write tests for this, file a follow up.
Eclipse
Comment #11
dsnopekGah! I just realized that this isn't enough when using in conjunction with per-operation value overrides from #2616492: Allow overriding cached values for specific operations to make it possible to use the same form class for multiple steps. Basically, the problem is that the overrides are applied to the cached values AFTER the tempstore entry is created in the WizardFactory.
In my work on page_manager, this manifests itself as allowing the "Page Access" to work (since that doesn't depend on values) but the "Selection Criteria" on a specific variant to fail. :-/
So, our nice little fix from #7 is insufficient...
Comment #12
eclipsegc commentedSo David and I discussed this at length and we'd both like to find a reproducible version of this report. Until then, I'm postponing.
Eclipse
Comment #13
juampynr commentedIs this still happening? I would need a couple screenshots to understand the issue before I could help.