Compare commits

...

2 Commits

Author SHA1 Message Date
Gregory Schier
095af8cf4b Refresh query when plugins reload in useTemplateFunctionConfig hook 2025-12-02 08:07:53 -08:00
Gregory Schier
e1c1ecc34d Try fix quotes for Windows 2025-12-02 05:45:01 -08:00
3 changed files with 18 additions and 14 deletions

View File

@@ -5,9 +5,9 @@
"private": true,
"version": "0.1.0",
"scripts": {
"build": "run-p build:*",
"build": "run-s build:*",
"build:1-build": "yaakcli build",
"build:2-cpywasm": "cpx '../../node_modules/@1password/sdk-core/nodejs/core_bg.*' build/",
"build:2-cpywasm": "cp \"../../node_modules/@1password/sdk-core/nodejs/core_bg.wasm\" build/",
"dev": "yaakcli dev"
},
"dependencies": {

View File

@@ -26,7 +26,7 @@
"endpoints": [
"https://update.yaak.app/check/{{target}}/{{arch}}/{{current_version}}"
],
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEMxRDJFREQ1MjExQjdGN0IKUldSN2Z4c2gxZTNTd1FHNCtmYnFXMHVVQzhuNkJOM1cwOFBodmdLall3ckhKenpKUytHSTR1MlkK"
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEVGRkFGMjQxRUNEOTQ3MzAKUldRd1I5bnNRZkw2NzRtMnRlWTN3R24xYUR3aGRsUjJzWGwvdHdEcGljb3ZJMUNlMjFsaHlqVU4K"
}
},
"bundle": {

View File

@@ -1,12 +1,14 @@
import { useQuery } from '@tanstack/react-query';
import type {
Folder,
GrpcRequest,
HttpRequest,
WebsocketRequest,
Workspace,
import {
environmentsAtom,
type Folder,
type GrpcRequest,
type HttpRequest,
httpResponsesAtom,
pluginsAtom,
type WebsocketRequest,
type Workspace,
} from '@yaakapp-internal/models';
import { environmentsAtom, httpResponsesAtom } from '@yaakapp-internal/models';
import type { GetTemplateFunctionConfigResponse, JsonPrimitive } from '@yaakapp-internal/plugins';
import { useAtomValue } from 'jotai';
import { md5 } from 'js-md5';
@@ -19,6 +21,7 @@ export function useTemplateFunctionConfig(
values: Record<string, JsonPrimitive>,
model: HttpRequest | GrpcRequest | WebsocketRequest | Folder | Workspace,
) {
const pluginsKey = useAtomValue(pluginsAtom);
const workspaceId = useAtomValue(activeWorkspaceIdAtom);
const environmentId = useAtomValue(activeEnvironmentIdAtom);
const responses = useAtomValue(httpResponsesAtom);
@@ -40,10 +43,11 @@ export function useTemplateFunctionConfig(
model,
functionName,
values,
responseKey,
workspaceId,
environmentId,
environmentsKey,
workspaceId, // Refresh when the active workspace changes
environmentId, // Refresh when the active environment changes
environmentsKey, // Refresh when environments change
responseKey, // Refresh when responses change
pluginsKey, // Refresh when plugins reload
],
placeholderData: (prev) => prev, // Keep previous data on refetch
queryFn: async () => {