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

Profile Dropdown - without key syntax - strange behavior #6961

Closed
luke- opened this issue Apr 22, 2024 · 7 comments · Fixed by #6965
Closed

Profile Dropdown - without key syntax - strange behavior #6961

luke- opened this issue Apr 22, 2024 · 7 comments · Fixed by #6965
Assignees
Labels

Comments

@luke-
Copy link
Contributor

luke- commented Apr 22, 2024

Related: #6960 (comment)
Directory Loader

@luke-
Copy link
Contributor Author

luke- commented Apr 22, 2024

Branch: Develop please

@yurabakhtin
Copy link
Contributor

@luke- PR #6965: I don't think we should use a value as key for case when it is not defined, because it may breaks profiles which were stored before. For example, if the options were defined as:

Male
Female
Diverse

then it works as array with autoincremented keys started with 0:

0 => Male
1 => Female
2 => Diverse

so some profiles were strored with gender = 0 and it worked well except of the People Filter.
The "loading" error was there because of this JS code, i.e. the loader is visible there instead of expected title "Male".

The PR fixes the filter issue, it can be merged, but maybe we should either add an additional info in the field hint One option per line. Key=>Value Format (e.g. yes=>Yes) or restrict for saving it without keys:

hint

@luke-
Copy link
Contributor Author

luke- commented Apr 23, 2024

@yurabakhtin Ok got it, a validator for the field (check for keys) would probably be the cleanest solution. Can you please implement this?

@yurabakhtin
Copy link
Contributor

@luke- I have added the validation in the commit 922b430:

validate-select

But I have also detected the same hint we have for the profile type "Checkbox List":

chekcboxlist-hint

and this type already uses a Value as Key when it is not defined, the code is here .
So here I am a bit confused, because I don't think we should restrict the "Checkbox List" field as I have done for the "Select" field, because such fields were stored in DB with using Values as Keys. Maybe we should update the hint of the "Checkbox List" field to inform the format may be without Keys. Of course better is to keep the same format and same validation for these fields, but in such case we should implement a migration to fix all stored wrong keys.

@luke-
Copy link
Contributor Author

luke- commented Apr 23, 2024

@yurabakhtin I would prefer if we align CheckboxList and SelectList and use the same validation and saved data keys here. Then we could also allow the type to be changed in future.

Would you like to customize the checkboxes and migrate the data?

@yurabakhtin
Copy link
Contributor

yurabakhtin commented Apr 24, 2024

@luke-

Would you like to customize the checkboxes and migrate the data?

Done in the commit 5710f77.
Options will be fixed by new migration with this way depending on field type:

checkbox-list

select-list

@luke-
Copy link
Contributor Author

luke- commented Apr 24, 2024

@yurabakhtin Thanks, good solution!

@luke- luke- closed this as completed Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants