mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-19 23:31:21 +02:00
Merge main into proxy branch (formatting and docs)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import type { WebsocketRequest } from '@yaakapp-internal/models';
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import type { WebsocketRequest } from "@yaakapp-internal/models";
|
||||
import type {
|
||||
CallWebsocketRequestActionRequest,
|
||||
GetWebsocketRequestActionsResponse,
|
||||
WebsocketRequestAction,
|
||||
} from '@yaakapp-internal/plugins';
|
||||
import { useMemo } from 'react';
|
||||
import { invokeCmd } from '../lib/tauri';
|
||||
import { usePluginsKey } from './usePlugins';
|
||||
} from "@yaakapp-internal/plugins";
|
||||
import { useMemo } from "react";
|
||||
import { invokeCmd } from "../lib/tauri";
|
||||
import { usePluginsKey } from "./usePlugins";
|
||||
|
||||
export type CallableWebSocketRequestAction = Pick<WebsocketRequestAction, 'label' | 'icon'> & {
|
||||
export type CallableWebSocketRequestAction = Pick<WebsocketRequestAction, "label" | "icon"> & {
|
||||
call: (request: WebsocketRequest) => Promise<void>;
|
||||
};
|
||||
|
||||
@@ -17,11 +17,11 @@ export function useWebsocketRequestActions() {
|
||||
const pluginsKey = usePluginsKey();
|
||||
|
||||
const actionsResult = useQuery<CallableWebSocketRequestAction[]>({
|
||||
queryKey: ['websocket_request_actions', pluginsKey],
|
||||
queryKey: ["websocket_request_actions", pluginsKey],
|
||||
queryFn: () => getWebsocketRequestActions(),
|
||||
});
|
||||
|
||||
// biome-ignore lint/correctness/useExhaustiveDependencies: none
|
||||
// oxlint-disable-next-line react-hooks/exhaustive-deps
|
||||
const actions = useMemo(() => {
|
||||
return actionsResult.data ?? [];
|
||||
}, [JSON.stringify(actionsResult.data)]);
|
||||
@@ -31,7 +31,7 @@ export function useWebsocketRequestActions() {
|
||||
|
||||
export async function getWebsocketRequestActions() {
|
||||
const responses = await invokeCmd<GetWebsocketRequestActionsResponse[]>(
|
||||
'cmd_websocket_request_actions',
|
||||
"cmd_websocket_request_actions",
|
||||
);
|
||||
const actions = responses.flatMap((r) =>
|
||||
r.actions.map((a: WebsocketRequestAction, i: number) => ({
|
||||
@@ -43,7 +43,7 @@ export async function getWebsocketRequestActions() {
|
||||
pluginRefId: r.pluginRefId,
|
||||
args: { websocketRequest },
|
||||
};
|
||||
await invokeCmd('cmd_call_websocket_request_action', { req: payload });
|
||||
await invokeCmd("cmd_call_websocket_request_action", { req: payload });
|
||||
},
|
||||
})),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user