diff --git a/src-tauri/bindings/analytics.ts b/src-tauri/bindings/analytics.ts index 23e21581..554ae988 100644 --- a/src-tauri/bindings/analytics.ts +++ b/src-tauri/bindings/analytics.ts @@ -1,5 +1,5 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type AnalyticsAction = "cancel" | "click" | "commit" | "create" | "delete" | "delete_many" | "duplicate" | "export" | "hide" | "import" | "launch" | "launch_first" | "launch_update" | "send" | "show" | "toggle" | "update" | "upsert"; +export type AnalyticsAction = "cancel" | "click" | "commit" | "create" | "delete" | "delete_many" | "duplicate" | "error" | "export" | "hide" | "import" | "launch" | "launch_first" | "launch_update" | "send" | "show" | "toggle" | "update" | "upsert"; -export type AnalyticsResource = "app" | "appearance" | "button" | "checkbox" | "cookie_jar" | "dialog" | "environment" | "folder" | "grpc_connection" | "grpc_event" | "grpc_request" | "http_request" | "http_response" | "link" | "key_value" | "plugin" | "select" | "setting" | "sidebar" | "tab" | "theme" | "workspace"; +export type AnalyticsResource = "app" | "appearance" | "button" | "checkbox" | "cookie_jar" | "dialog" | "environment" | "folder" | "grpc_connection" | "grpc_event" | "grpc_request" | "http_request" | "http_response" | "key_value" | "link" | "mutation" | "plugin" | "select" | "setting" | "sidebar" | "tab" | "theme" | "workspace"; diff --git a/src-tauri/src/analytics.rs b/src-tauri/src/analytics.rs index 25e3c463..a3e8ff0b 100644 --- a/src-tauri/src/analytics.rs +++ b/src-tauri/src/analytics.rs @@ -33,8 +33,9 @@ pub enum AnalyticsResource { GrpcRequest, HttpRequest, HttpResponse, - Link, KeyValue, + Link, + Mutation, Plugin, Select, Setting, @@ -67,6 +68,7 @@ pub enum AnalyticsAction { Delete, DeleteMany, Duplicate, + Error, Export, Hide, Import, diff --git a/src-tauri/yaak-models/bindings/models.ts b/src-tauri/yaak-models/bindings/models.ts index fa8d2d67..c58b9698 100644 --- a/src-tauri/yaak-models/bindings/models.ts +++ b/src-tauri/yaak-models/bindings/models.ts @@ -58,7 +58,7 @@ export type SyncHistory = { model: "sync_history", id: string, workspaceId: stri export type SyncState = { model: "sync_state", id: string, workspaceId: string, createdAt: string, updatedAt: string, flushedAt: string, modelId: string, checksum: string, relPath: string, syncDir: string, }; -export type UpdateSource = "sync" | "window" | "plugin" | "background"; +export type UpdateSource = "sync" | "window" | "plugin" | "background" | "import"; export type Workspace = { model: "workspace", id: string, createdAt: string, updatedAt: string, name: string, description: string, settingValidateCertificates: boolean, settingFollowRedirects: boolean, settingRequestTimeout: number, }; diff --git a/src-web/commands/openWorkspaceFromSyncDir.tsx b/src-web/commands/openWorkspaceFromSyncDir.tsx index 14ff16d7..2b79c1aa 100644 --- a/src-web/commands/openWorkspaceFromSyncDir.tsx +++ b/src-web/commands/openWorkspaceFromSyncDir.tsx @@ -4,7 +4,7 @@ import { createFastMutation } from '../hooks/useFastMutation'; import { showSimpleAlert } from '../lib/alert'; import { router } from '../lib/router'; -export const openWorkspaceFromSyncDir = createFastMutation({ +export const openWorkspaceFromSyncDir = createFastMutation({ mutationKey: [], mutationFn: async () => { const dir = await open({ diff --git a/src-web/commands/switchWorkspace.tsx b/src-web/commands/switchWorkspace.tsx index 5dd4850f..461b4922 100644 --- a/src-web/commands/switchWorkspace.tsx +++ b/src-web/commands/switchWorkspace.tsx @@ -5,15 +5,16 @@ import { getRecentRequests } from '../hooks/useRecentRequests'; import { router } from '../lib/router'; import { invokeCmd } from '../lib/tauri'; -export const switchWorkspace = createFastMutation({ - mutationKey: ['open_workspace'], - mutationFn: async ({ - workspaceId, - inNewWindow, - }: { +export const switchWorkspace = createFastMutation< + void, + unknown, + { workspaceId: string; inNewWindow: boolean; - }) => { + } +>({ + mutationKey: ['open_workspace'], + mutationFn: async ({ workspaceId, inNewWindow }) => { const environmentId = (await getRecentEnvironments(workspaceId))[0] ?? undefined; const requestId = (await getRecentRequests(workspaceId))[0] ?? undefined; const cookieJarId = (await getRecentCookieJars(workspaceId))[0] ?? undefined; diff --git a/src-web/components/CreateWorkspaceDialog.tsx b/src-web/components/CreateWorkspaceDialog.tsx index b3560369..e53f3b7b 100644 --- a/src-web/components/CreateWorkspaceDialog.tsx +++ b/src-web/components/CreateWorkspaceDialog.tsx @@ -24,7 +24,6 @@ export function CreateWorkspaceDialog({ hide }: Props) { className="pb-3 max-h-[50vh]" onSubmit={async (e) => { e.preventDefault(); - if (!settingSyncDir) return; const workspace = await upsertWorkspace.mutateAsync({ name }); if (workspace == null) return; diff --git a/src-web/components/Toasts.tsx b/src-web/components/Toasts.tsx index 4c152e8a..766a0611 100644 --- a/src-web/components/Toasts.tsx +++ b/src-web/components/Toasts.tsx @@ -16,7 +16,7 @@ export const Toasts = () => { const toasts = useAtomValue(toastsAtom); return ( -
+
{toasts.map(({ message, ...props }: ToastInstance) => ( { mutationKey: MutationKey; @@ -7,6 +9,7 @@ interface MutationOptions { onSettled?: () => void; onError?: (err: TError) => void; onSuccess?: (data: TData) => void; + disableToastError?: boolean; } type CallbackMutationOptions = Omit< @@ -21,7 +24,7 @@ export function createFastMutation, ) => { - const { mutationKey, mutationFn, onSuccess, onError, onSettled } = { + const { mutationKey, mutationFn, onSuccess, onError, onSettled, disableToastError } = { ...defaultArgs, ...args, }; @@ -30,8 +33,18 @@ export function createFastMutation