Skip to content

Commit d2c1bd7

Browse files
committed
Fix chaining multiple requests together.
Fixes https://yaak.app/feedback/posts/request-chaining-issue-on-cold-start
1 parent 020589f commit d2c1bd7

File tree

1 file changed

+8
-0
lines changed
  • plugins/template-function-response/src

1 file changed

+8
-0
lines changed

plugins/template-function-response/src/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ export const plugin: PluginDefinition = {
7272
name: 'header',
7373
label: 'Header Name',
7474
async dynamic(ctx, args) {
75+
// Dynamic form config also runs during send-time rendering.
76+
// Keep this preview-only to avoid side-effect request sends.
77+
if (args.purpose !== 'preview') return null;
78+
7579
const response = await getResponse(ctx, {
7680
requestId: String(args.values.request || ''),
7781
purpose: args.purpose,
@@ -146,6 +150,10 @@ export const plugin: PluginDefinition = {
146150
label: 'JSONPath or XPath',
147151
placeholder: '$.books[0].id or /books[0]/id',
148152
dynamic: async (ctx, args) => {
153+
// Dynamic form config also runs during send-time rendering.
154+
// Keep this preview-only to avoid side-effect request sends.
155+
if (args.purpose !== 'preview') return null;
156+
149157
const resp = await getResponse(ctx, {
150158
requestId: String(args.values.request || ''),
151159
purpose: 'preview',

0 commit comments

Comments
 (0)