discourse/app/assets/javascripts/select-kit/addon/services
Kelv d3fd65dcf1
DEV: replace select-kit tags mixin with tag-utils service (#32509)
This PR replaces the use of the tags mixin for select-kit components
with a tag-utils service instead.

Main changes:
1. Remove methods needed to set selectKitOptions key `allowAny` from the
service, this was largely unnecessary since 3 out of 4 components using
the mixin already defined their own selectKitOptions `allowAny` (which
would override the mixin version), and the last component
`mini-tag-chooser` overrode the _value_ with its own `allowAnyTag`
property.
2. Remove all state from service and decouple from whole components by
explicitly requiring that any dependent property/callback be passed in
as arguments to the methods (so anything relying on `this` or
`context`). `site` and `siteSettings` are explicitly injected as
services into the tag-utils service as well for access to their
properties.
3. `_transformJson` needs to be passed into the service as a callback
that acts on the component, and I chose the `@bind` decorator for this.
`@action` doesn't work too well here as it results in subtle timing
errors where later on in the cycle, this results in setting properties
on destroyed components.
2025-05-06 14:38:55 +08:00
..
tag-utils.js