mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-23 00:58:32 +02:00
Fix settings query store and analytics
This commit is contained in:
@@ -26,6 +26,7 @@ pub enum AnalyticsResource {
|
|||||||
KeyValue,
|
KeyValue,
|
||||||
Sidebar,
|
Sidebar,
|
||||||
Workspace,
|
Workspace,
|
||||||
|
Setting,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AnalyticsResource {
|
impl AnalyticsResource {
|
||||||
|
|||||||
@@ -914,16 +914,11 @@ async fn cmd_track_event(
|
|||||||
analytics::track_event(&window.app_handle(), resource, action, attributes).await;
|
analytics::track_event(&window.app_handle(), resource, action, attributes).await;
|
||||||
}
|
}
|
||||||
(r, a) => {
|
(r, a) => {
|
||||||
println!(
|
|
||||||
"HttpRequest: {:?}",
|
|
||||||
serde_json::to_string(&AnalyticsResource::HttpRequest)
|
|
||||||
);
|
|
||||||
println!("Send: {:?}", serde_json::to_string(&AnalyticsAction::Send));
|
|
||||||
error!(
|
error!(
|
||||||
"Invalid action/resource for track_event: {resource}.{action} = {:?}.{:?}",
|
"Invalid action/resource for track_event: {resource}.{action} = {:?}.{:?}",
|
||||||
r, a
|
r, a
|
||||||
);
|
);
|
||||||
return Err("Invalid event".to_string());
|
return Err("Invalid analytics event".to_string());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -11,8 +11,9 @@ export function useSettings() {
|
|||||||
useQuery({
|
useQuery({
|
||||||
queryKey: settingsQueryKey(),
|
queryKey: settingsQueryKey(),
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
return (await invoke('cmd_get_settings')) as Settings;
|
const settings = (await invoke('cmd_get_settings')) as Settings;
|
||||||
|
return [settings];
|
||||||
},
|
},
|
||||||
}).data ?? undefined
|
}).data?.[0] ?? undefined
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export function useUpdateSettings() {
|
|||||||
await invoke('cmd_update_settings', { settings });
|
await invoke('cmd_update_settings', { settings });
|
||||||
},
|
},
|
||||||
onMutate: async (settings) => {
|
onMutate: async (settings) => {
|
||||||
queryClient.setQueryData<Settings>(settingsQueryKey(), settings);
|
queryClient.setQueryData<Settings[]>(settingsQueryKey(), [settings]);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user