discourse/app/assets/javascripts/select-kit
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
..
addon FIX: pass ancestor data to category badge helper (#35169) 2025-10-03 15:43:34 +04:00
app
.npmrc DEV: Prevent npm usage (#13945) 2021-08-04 22:04:58 +02:00
ember-cli-build.js DEV: Update ember-cli to 4.12.0 (#21074) 2023-04-19 12:58:29 +02:00
index.js DEV: @babel/plugin-proposal-decorators -> decorator-transforms (#27260) 2024-06-10 15:51:48 +01:00
package.json DEV: Pin Webpack to 5.99.9 (again) (#35106) 2025-10-01 09:25:13 +01:00