Prompt
Maintain consistency in configuration values across the application by following these practices:
-
Use properly formatted template strings for configuration keys Template strings for configuration keys should be properly formatted with correct syntax to avoid runtime errors and ensure consistent storage.
// Incorrect const key = `${projectId}-${datasetId-chart-metrics`; // Correct const key = `${projectId}-${datasetId}-chart-metrics`; -
Update identifiers when functionality changes When updating functionality that relies on persistent identifiers (like notifications), update the identifier to ensure proper behavior for all users.
// When updating a notification: // Old id: "lw3-1", // New (when content changes) id: "lw3-2", -
Use consistent default values for the same parameter When a parameter is used in multiple places, ensure that default values are consistent to avoid confusing behavior.
// Inconsistent defaults const [selectedTab] = useQueryParam("display", withDefault(StringParam, "details")); // vs elsewhere onExpand={() => setSelectedTab("preview")} // Consistent defaults const [selectedTab] = useQueryParam("display", withDefault(StringParam, "preview")); -
Avoid hardcoded values in favor of configurable settings Configuration values (especially URLs, endpoints, and service-specific settings) should be configurable rather than hardcoded, allowing for easier environment-specific customization.
// Hardcoded (avoid) case LLMAdapter.Atla: return "https://api.atla-ai.com/v1/integrations/langfuse"; // Configurable (preferred) case LLMAdapter.Atla: return customization?.defaultBaseUrlAtla ?? "";