discourse/app/assets/javascripts/select-kit/addon
David Battersby 875a56921f
FIX: pass ancestor data to category badge helper (#35169)
The badge in `CategoryChooser` is incorrectly showing the child category
badge when displaying both parent and child as the selected option. This
was already fixed for cases where the `ancestors` option is passed to
`categoryBadgeHTML` in the category link helper.

Updating the option within CategoryChooser fixes this issue, but I have
also added a fallback fix for any other components that still use the
recursive option.

_Note: as part of #26638 the preferred approach was to pass `ancestors:
category.predecessors` in place of `recursive: true`. That way reducing
multiple calls to `Category.findById` at the component level when
looping through category parents. We may want to completely remove the
recursive option in the future but leaving it be for now._

### Before

The category emojis are working correctly on the top header:

<img width="448" height="68" alt="Screenshot 2025-10-03 at 2 44 02 PM"
src="https://github.com/user-attachments/assets/f929cebf-3523-40cd-ac44-4c8d240793d5"
/>

The category chooser is showing the incorrect emoji for the parent
category when editing the topic:

<img width="430" height="159" alt="Screenshot 2025-10-03 at 2 43 55 PM"
src="https://github.com/user-attachments/assets/a7ed5cff-db10-4899-8096-45bd2b882eea"
/>

### After

<img width="451" height="153" alt="Screenshot 2025-10-03 at 2 43 02 PM"
src="https://github.com/user-attachments/assets/6033c164-3451-4526-8ff0-29819f8ae3d7"
/>
2025-10-03 15:43:34 +04:00
..
components FIX: pass ancestor data to category badge helper (#35169) 2025-10-03 15:43:34 +04:00
lib DEV: Replace the use of Ember's .findBy for native methods on arrays (#34557) 2025-09-24 15:32:13 -03:00
services DEV: replace select-kit tags mixin with tag-utils service (#32509) 2025-05-06 14:38:55 +08:00