Add automation routes and enhance header metrics management
- Introduced new routes for Automation Rules and Automation Tasks in the frontend. - Updated the AppSidebar to include sub-items for Automation navigation. - Enhanced HeaderMetricsContext to manage credit and page metrics more effectively, ensuring proper merging and clearing of metrics. - Adjusted AppLayout and TablePageTemplate to maintain credit balance while managing page metrics.
This commit is contained in:
@@ -473,18 +473,19 @@ export default function TablePageTemplate({
|
||||
}
|
||||
|
||||
// Update metrics if we have new values
|
||||
// HeaderMetricsContext will automatically merge these with credit balance
|
||||
if (metricsKey) {
|
||||
setMetrics(headerMetrics);
|
||||
hasSetMetricsRef.current = true;
|
||||
prevMetricsRef.current = metricsKey;
|
||||
} else if (hasSetMetricsRef.current) {
|
||||
// Only clear if we previously set metrics
|
||||
// Clear page metrics (credit balance will be preserved by HeaderMetricsContext)
|
||||
setMetrics([]);
|
||||
hasSetMetricsRef.current = false;
|
||||
prevMetricsRef.current = '';
|
||||
}
|
||||
|
||||
// Cleanup: clear metrics when component unmounts (only if we set them)
|
||||
// Cleanup: clear page metrics when component unmounts (credit balance preserved)
|
||||
return () => {
|
||||
if (hasSetMetricsRef.current) {
|
||||
setMetrics([]);
|
||||
|
||||
Reference in New Issue
Block a user