Skip to content
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

performReadonlyTransformation() for SearchableDropdownField and SearchableMultiDropdownField doesn't respect lazy loading #11293

Closed
GuySartorelli opened this issue Jun 25, 2024 · 4 comments

Comments

@GuySartorelli
Copy link
Member

GuySartorelli commented Jun 25, 2024

A follow-up to #11272

If you call performReadonlyTransformation() on a SearchableDropdownField or SearchableMultiDropdownField, it will convert the source DataList into an array, which requires pulling data for all records in the list from the database.

All that's really needed is data for the record(s) which are currently selected for the field, since it's read-only it doesn't matter what other options could have been selected, because they weren't selected.

We may need to create a new readonly formfield for these - at the very least we'll need to implement some specific logic in the performReadonlyTransformation() method to instantiate the readonly field correctly without pulling unnecessary data.

Acceptance criteria

  • Calling performReadonlyTransformation() only loads data from the DB that is required to display the currently selected record(s) in the readonly form.
    OR
  • Calling performReadonlyTransformation() doesn't load any data from the DB - when the read only form is rendered, only data that is required to display the currently selected record(s) is loaded.

PRs

@johannesx75
Copy link
Contributor

johannesx75 commented Jun 27, 2024

I'm working on it. Feel free to assign the issue to me.

My first Idea was to overwrite performReadonlyTransformation and just change source to the selected items if the control is readonly.

Unfortunately that wont work. The value can still be set on a readonly Formfield. For example in form scaffolding the field is created and performReadonlyTransformation is run before the value is set.

So the acceptance criteria is probably missing changes to the value after performReadonlyTransformation.

@johannesx75
Copy link
Contributor

PR for this is at #11297
I'm not to happy with it, but I guess it works and is in line with the rest of the controls implementation.

@emteknetnz emteknetnz self-assigned this Jul 2, 2024
@digitweaks
Copy link

I was looking for that issue, I think it is what's bugging the UploadField.
I have this Error: Injector.get(): Component SearchableDropdownField does not exist (when calling vendor.js)

It happens when I try to select an image from the media folder, is that related?

@GuySartorelli
Copy link
Member Author

@digitweaks That sounds like a separate (but tangentially related) issue. Feel free to open a new issue, and explain what problems that's causing. Note that if it's just a console error but everything is otherwise working as expected, it is very unlikely to be prioritised.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants