Replies: 1 comment 1 reply
-
|
Thanks for pointing this out. I think we really need to come up with some kind of naming strategy so that users don’t run into issues when creating custom factories. Perhaps we could organize a vote during the process, encouraging project users to share their opinions or at least cast a vote for one prefix or another. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have carefully read the "Why no prefixes" section in the documentation. While I understand the rationale behind omitting prefixes, I am encountering practical issues when using Signality to create my own composables.
The goal of these utilities is often to use them within custom composables. In these contexts, we aren't always working within a class; sometimes we are inside standalone functions, methods, or constructors. This makes the lack of a prefix problematic, as it frequently leads to naming collisions.
For example, in my current project, I have a custom
useWorkflow()composable where I need to usetitle(). Because there is no prefix, I cannot simply assign it to a variable likeconst title = title(). I am forced to find a workaround name, which feels inconsistent, especially when compared to using these utilities as class properties, where this issue doesn't arise.I believe this warrants a reconsideration of the naming convention, especially since
createInjectablewill encourage defining injectables as functions rather than classes.Personally, I would advocate for a
useXxxnaming convention. I believeinjectXxxshould be reserved for utilities that exclusively useinject()under the hood. Since many composables might useinject()alongside other logic (or might not use it at all)useXxxwould be a more accurate and flexible standard for the Signality ecosystem.Beta Was this translation helpful? Give feedback.
All reactions