When an implementation depends on environment-specific configuration (e.g., app base URL) or capability flags, apply configuration consistently and gate user actions with real state.
Standards 1) Centralize environment-specific URL building
2) Don’t gate solely on feature flags
ls-remote).3) Separate env/config from account identity in shared state
clineAppBaseUrl) but not account-derived fields just to support duplicated UI.AccountView) rather than publishing them in global context.Example pattern (centralized builder + local derivation)
// config-only value belongs in context/provider
export const clineAppBaseUrl: string | undefined = /* env resolution */ undefined;
function buildAppUrl(baseUrl: string | undefined, path: string) {
if (!baseUrl) return undefined;
return `${baseUrl}${path}`; // extend with attribution/client attribution if needed
}
function AccountView() {
const { clineAppBaseUrl } = useAccount();
const user = /* fetch user inside this view */ null;
const privacyUrl = user
? buildAppUrl(clineAppBaseUrl, `/privacy?uid=${user.id}`)
: undefined;
// render privacy button only when privacyUrl is resolved
}
Apply this standard to keep links correct across environments (self-hosted/proxy setups), prevent confusing UX from incomplete gating, and reduce unnecessary cross-component coupling.