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