-
-
Notifications
You must be signed in to change notification settings - Fork 824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SearchKit - Fix Campaign, State, Country selectors (again) #25053
SearchKit - Fix Campaign, State, Country selectors (again) #25053
Conversation
This fixes the attempted fix from 7deb8c3 which broke more than it fixed. The goal was to use ajax to load state, country & county lists because they are too long to prefetch. But switching ALL FK fields to use ajax instead of option suffixes was too heavy-handed and would have broken a lot of existing searches by no longer supporting those pseudoconstants in the UI. This restores all previous option list fields, and targets only address country/county/state fields. Ideally we'd turn the prefetch flag off on those fields but that would have major consequenses for formBuilder and existing searches. So this uses a subtler approach and tweaks their "suffixes" metadata to remove :name which didn't really make sense for those fields anyway since they don't actually have machine names. Then it teaches SearchKit to use ajax for selecting from fields with no :name, while still using :label for their display value in the table.
(Standard links)
|
@colemanw if this re-enables the entire pre-load of all options on |
@eileenmcnaughton no it does not re-enable pre-loading of Campaigns. To clarify that aspect: BeforeNo option lists were loaded for any field with an FK. AfterAll fields with an option list get loaded except for Campaign, Country, County and StateProvince - those all use ajax. |
@colemanw & the way in which campaign_id differs from event_id is that event_id doesn't have a a pseudoconstant defined? So it would never pre-load anyway?
|
ie - the same performance issue would affect event_id on some sites... |
@eileenmcnaughton fields that don't have a pseudoconstant by definition have no option list, so there's nothing to pre-load. Those fields are unaffected by any of this as they would be BeforeUse ajax AfterUse ajax |
ok |
Overview
This fixes the attempted fix from 7deb8c3 which broke more than it fixed.
Before
Lots of SearchKit field no longer showing option value correctly. E.g. create a search for Contributions and add "Financial Type" as a column. It will show as an integer rather than showing the label.
After
Fixed.
Technical Details
The goal was to use ajax to load state, country & county lists because they are too long to prefetch. But switching all FK fields to use ajax instead of option suffixes was too heavy-handed and would have broken a lot of existing searches by no longer supporting those pseudoconstants in the UI.
This restores all previous option list fields, and targets only address country/county/state fields. Ideally we'd turn the prefetch flag off on those fields but that would have major consequences for formBuilder and existing searches.
So this uses a subtler approach and tweaks their "suffixes" metadata to remove
name
which didn't really make sense for those fields anyway since they don't actually have machine names. Then it teaches SearchKit to use ajax for selecting from fields with no:name
, while still using:label
for their display value in the table.