Page MenuHomePhabricator

Rethink useGeneratedId composable
Open, LowestPublic1 Estimated Story Points

Description

Currently, the useGeneratedId composable has several flaws:

  • When using an "external ID" (the ID prop or attr of the component), it prefixes that ID with cdx-, which would likely lead to double-prefixing. We should assume that external IDs are already appropriately prefixed (either with cdx- or something else)
  • When using an external ID, you can't add a descriptive suffix, because the "identifier" parameter takes precedence over an external ID
  • When using an external ID, the returned ID is not reactive to the external ID changing. (Currently, useGeneratedId returns a string, but even when it did return a Ref, it wasn't reactive.)

We should come up with an approach to ID generation that is able to use the external/parent ID in a more sensible way. Right now we don't use this feature at all, instead we exclusively use the identifier-based code path.