fix(frontend): add missing i18n keys and improve workspace switch cache invalidation

- Add common.status.ready i18n key for zh/en locales
- Add ready/initialized/archived/failed status colors to dashboard widgets
- Expand QueryInvalidator to invalidate projectOverview, workflowStatusCounts,
  and dashboardStats queries on workspace switch
This commit is contained in:
catlog22
2026-02-28 10:00:36 +08:00
parent 4763edb0e4
commit 46989dcbad
5 changed files with 19 additions and 5 deletions

View File

@@ -53,13 +53,18 @@ function QueryInvalidator() {
const registerQueryInvalidator = useWorkflowStore((state) => state.registerQueryInvalidator);
useEffect(() => {
// Register callback to invalidate all 'workspace' prefixed queries
// Register callback to invalidate all workspace-related queries on workspace switch
const callback = () => {
queryClient.invalidateQueries({
predicate: (query) => {
const queryKey = query.queryKey;
// Check if the first element of the query key is 'workspace'
return Array.isArray(queryKey) && queryKey[0] === 'workspace';
if (!Array.isArray(queryKey)) return false;
const prefix = queryKey[0];
// Invalidate all query families that depend on workspace data
return prefix === 'workspace'
|| prefix === 'projectOverview'
|| prefix === 'workflowStatusCounts'
|| prefix === 'dashboardStats';
},
});
};