Skip to content

Commit 6ddb898

Browse files
committed
Fix resource preview
1 parent 4ac53bc commit 6ddb898

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

apps/builder/app/builder/features/settings-panel/resource-panel.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,7 @@ import {
6666
type InstancePath,
6767
} from "~/shared/awareness";
6868
import { updateWebstudioData } from "~/shared/instance-utils";
69-
import {
70-
computeExpression,
71-
rebindTreeVariablesMutable,
72-
} from "~/shared/data-variables";
69+
import { rebindTreeVariablesMutable } from "~/shared/data-variables";
7370
import { parseCurl, type CurlRequest } from "./curl";
7471

7572
export const parseResource = ({
@@ -558,7 +555,7 @@ export const getResourceScopeForInstance = ({
558555
const name = encodeDataVariableId(dataSourceId);
559556
scope[name] = value;
560557
aliases.set(name, dataSource.name);
561-
variableValues.set(dataSource.name, value);
558+
variableValues.set(dataSourceId, value);
562559
}
563560
}
564561
}
@@ -621,7 +618,7 @@ export const useResourceScope = ({ variable }: { variable?: DataSource }) => {
621618
const key = encodeDataVariableId(variable.id);
622619
delete newScope[key];
623620
newAliases.delete(key);
624-
newVariableValues.delete(variable.name);
621+
newVariableValues.delete(variable.id);
625622
}
626623
return {
627624
scope: newScope,
@@ -798,7 +795,7 @@ const parseHeaders = (headers: Resource["headers"]) => {
798795
const newHeaders = headers.filter((header) => {
799796
// cast raw expression result to string
800797
const value = String(
801-
computeExpression(header.value, new Map())
798+
evaluateExpressionWithinScope(header.value, {})
802799
).toLowerCase();
803800
if (isCacheControl(header.name)) {
804801
// move simple header like Cache-Control: max-age=10 to dedicated input
@@ -1180,6 +1177,7 @@ export const GraphqlResourceForm = forwardRef<
11801177
}
11811178
}}
11821179
/>
1180+
<input type="hidden" name="method" value="post" />
11831181

11841182
<Grid gap={1}>
11851183
<Label htmlFor={queryId}>Query</Label>

0 commit comments

Comments
 (0)