Record list fields#2927
Conversation
…ools-theme into record-list-fields
|
After a brief review manually and bigger Claude review, here's some preliminary things to fix: The issue may have been misleading about replacing all components in the filters, since some of the filter controls don't match the component normally used for that field. FiltersRegressions
Bugs
|
|
Here is a full Claude review I did locally while it had access to a dev site running the code: Code Review: Record List Fields → Web Components (
|
cairocoder01
left a comment
There was a problem hiding this comment.
Looking pretty good. A few things to clean up yet.
| } else if (type === 'text' || type === 'communication_channel') { | ||
| val = customComponent.value; | ||
|
|
||
| switch ($('.filter-by-text-comms-option:checked').val()) { |
There was a problem hiding this comment.
This looks like an existing bug, but let's quick address it. This jquery selector will select the first checked option across ALL fields. So if you're setting filters on both email and phone, it will use the selection for the first one it finds. We need to scope this selector to the field container. Each tab-panel has an id of the field_id. We can follow the pattern of the connections field logic just before this that uses: $(`#${field} .all-connections`) to do something more like $(`#${field} .filter-by-text-comms-option:checked`). This makes sure we're selecting the options within the field we're actually processing at this point.
There was a problem hiding this comment.
Sounds good! Those options are rendered outside of the field itself, so I added them to a div of id="filter_by_text_comms_option_" which I believe should resolve it! Thanks for noticing this, too. The switch now checks for an option under the element with the id from the new div. Let me know if you have a better suggestion.
| val = val.map((v) => | ||
| typeof v === 'string' | ||
| ? v.replace(/</g, '<').replace(/>/g, '>') | ||
| : v, | ||
| ); |
There was a problem hiding this comment.
According to Claude, this is only needed if the tags field has allowAdd. Since we're removing that, I think we can remove this, right? Is there another reason it's here?
There was a problem hiding this comment.
I initially was mistakenly rendering the single-select labels to show the value itself: "Under 18 years old" would display: "<18" instead, so I had to handle the special characters in order to render them properly. When I changed the labels to show the name correctly, I didn't realize that was no longer needed. Thanks!
| typeof value === 'string' && | ||
| (value.includes('<') || value.includes('>')) | ||
| ) { | ||
| value = value.replace(/</g, '<').replace(/>/g, '>'); |
There was a problem hiding this comment.
According to Claude, this is only needed if the tags field has allowAdd. Since we're removing that, I think we can remove this, right? Is there another reason it's here?
There was a problem hiding this comment.
Same as the above comment. I initially was handled special characters "<", but that was when I was rendering the value in the label rather than the name.
| const tagName = this.tagName.toLowerCase(); | ||
|
|
||
| if (tagName === 'dt-date') { | ||
| this.reset(); |
There was a problem hiding this comment.
Why can't we use reset for all components? That is supposed to work for every component.
There was a problem hiding this comment.
I see! I set up the other ones before, just trying to manually set the value to be empty. I handled date separately at the end, since it had both a "Start" and "End", I couldn't just reset one single value. I then found the .reset() function and didn't check if the others had it. Thanks!
|
Some additional dead code that can be removed after you confirm it is for the old UI and not needed anymore: Dead code, safe to remove
|









This resolves #2845 to replace record-list fields with dt-web-components. Filtering functionality was updated to accommodate the new changes & appeared to work properly, but more testing is likely needed.
I updated these things:
@cairocoder01 let me know any suggestions!
Related Components PR: DiscipleTools/disciple-tools-web-components#208