Ensure UI and navigation that depends on environment config or feature flags are consistent, preflighted, and deterministic:
Example (centralized builder + fallback):
type Env = { appBaseUrl?: string };
const defaultBaseUrl = "https://app.cline.bot"; // or production constant
function buildDashboardUrl(env: Env, path: string) {
const base = env.appBaseUrl ?? defaultBaseUrl;
const attribution = "?client=desktop"; // example of shared attribution
return `${base}${path}${attribution}`;
}
// In a view: all buttons use the same builder
const dashboardUrl = buildDashboardUrl(env, "/dashboard");
Example (preflight gating with runtime validation preserved):
const canOffer = featureFlagEnabled && hasGitRemote && hasGitBranch; // cheap session data
<button disabled={!canOffer} onClick={() => {
// runtime checks still required
if (isDirty || !lsRemoteOk) return showError();
runCloudHandoff();
}}>
Open cloud handoff
</button>