ENH Refactor the way selected options are returned for read only tag fields #310
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
When transforming a tag field to read only mode and calling the
Field
method on it for rendering, it was observed that all options in the tag field source were being returned from the database, and iterated to provide a full list on which the selected options are then filtered. Where there are large numbers of items in the source this was causing performance issues.The
getOptions
method that is called for setting the values on the read only tag field accepts a$onlySelected
parameter which, when set totrue
, will avoid the loading of all options, and instead just return the selected values. Calling the getOptions method in this way means that we no longer need the filtering within theReadonlyTagField
class.Manual testing steps
These steps are included on issue #309
Issues
Pull request checklist