Problem
Two unrelated things are both called select…:
- Redux state selectors —
selectIsAnalyticsEnabled(state), ~750 of them across the repo.
- DI service selectors —
selectDesktopAnalyticsDep(services), 25 of them, fed to useServices.
The word says nothing about which one you are looking at, and the stems collide: selectAnalytics… can mean "read analytics state" or "hand me the analytics service". A component using both reads like this today (SupportConsentPopover.tsx):
const isAnalyticsEnabled = useSelector(selectIsAnalyticsEnabled);
const { analytics } = useServices(selectDesktopAnalyticsDep);
Only the hook tells them apart, and the argument they take is not the same kind of thing at all: one reads a slice of the store, the other pulls a dependency out of the injected services. The Dep suffix is the only hint, and it is easy to miss at the end of a long name.
Proposal
Use inject for the DI side, keeping select for state:
const isAnalyticsEnabled = useSelector(selectIsAnalyticsEnabled);
const { analytics } = useServices(injectDesktopAnalytics);
inject says what actually happens — a dependency is injected — and the two can no longer be confused at a glance or by autocomplete. It also frees the Dep suffix: injectDesktopAnalytics reads better than injectDesktopAnalyticsDep, though keeping Dep would be a smaller change if the type names (DesktopAnalyticsDep) should stay aligned.
Scope
- 25 exported
select…Dep functions and their call sites.
createSelectDispatchDep / selectDispatchDep in @suite-common/redux-utils.
- The dependency-injection skill, which documents the current convention.
- Mechanical rename, no behaviour change; could ride along with an existing DI touch or be done in one pass.
Open questions
injectXDep or injectX? The type is XDep, so dropping the suffix breaks the name symmetry the skill asks for, but reads better.
- Same treatment for the getter variants (
useGetter) if any are named select….
Problem
Two unrelated things are both called
select…:selectIsAnalyticsEnabled(state), ~750 of them across the repo.selectDesktopAnalyticsDep(services), 25 of them, fed touseServices.The word says nothing about which one you are looking at, and the stems collide:
selectAnalytics…can mean "read analytics state" or "hand me the analytics service". A component using both reads like this today (SupportConsentPopover.tsx):Only the hook tells them apart, and the argument they take is not the same kind of thing at all: one reads a slice of the store, the other pulls a dependency out of the injected services. The
Depsuffix is the only hint, and it is easy to miss at the end of a long name.Proposal
Use
injectfor the DI side, keepingselectfor state:injectsays what actually happens — a dependency is injected — and the two can no longer be confused at a glance or by autocomplete. It also frees theDepsuffix:injectDesktopAnalyticsreads better thaninjectDesktopAnalyticsDep, though keepingDepwould be a smaller change if the type names (DesktopAnalyticsDep) should stay aligned.Scope
select…Depfunctions and their call sites.createSelectDispatchDep/selectDispatchDepin@suite-common/redux-utils.Open questions
injectXDeporinjectX? The type isXDep, so dropping the suffix breaks the name symmetry the skill asks for, but reads better.useGetter) if any are namedselect….