Merge pull request #11360 from ToolJet/fix-resolved-query-headers

Fix request, response, responseHeaders from resolved query not being part of  dependency graph
This commit is contained in:
Johnson Cherian 2024-11-21 11:56:38 +05:30 committed by GitHub
commit eea5af776c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 32 additions and 6 deletions

View file

@ -1 +1 @@
3.0.2-ce-lts
3.0.3-ce-lts

View file

@ -1 +1 @@
3.0.2-ce-lts
3.0.3-ce-lts

View file

@ -67,6 +67,13 @@ export const codeEditorConfig = {
exposedVariables: {
value: '',
},
actions: [
{
handle: 'setValue',
displayName: 'Set value',
params: [{ handle: 'setValue', defaultValue: '' }],
},
],
definition: {
others: {
showOnDesktop: { value: '{{true}}' },

View file

@ -441,7 +441,9 @@ export const createQueryPanelSlice = (set, get) => ({
isLoading: false,
data: finalData,
rawData,
metadata: data.metadata,
metadata: data?.metadata,
request: data?.metadata?.request,
response: data?.metadata?.response,
});
resolve({ status: 'ok', data: finalData });

View file

@ -183,7 +183,7 @@ export const createResolvedSlice = (set, get) => ({
);
Object.entries(details).forEach(([key, value]) => {
if (['isLoading', 'data', 'rawData'].includes(key)) {
if (['isLoading', 'data', 'rawData', 'request', 'response', 'responseHeaders', 'metadata'].includes(key)) {
if (typeof value !== 'function') get().updateDependencyValues(`queries.${queryId}.${key}`);
}
});

View file

@ -1,5 +1,5 @@
/* eslint-disable import/no-unresolved */
import React, { useState } from 'react';
import React, { useState, useEffect } from 'react';
import CodeMirror from '@uiw/react-codemirror';
import { okaidia } from '@uiw/codemirror-theme-okaidia';
import { githubLight } from '@uiw/codemirror-theme-github';
@ -51,6 +51,16 @@ export const CodeEditor = ({ id, height, darkMode, properties, styles, setExpose
return height || 'auto';
}, [height]);
useEffect(() => {
const _setValue = (value) => {
if (typeof value === 'string') {
codeChanged(value);
}
};
setExposedVariable('setValue', _setValue);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
return (
<div data-disabled={disabledState} style={editorStyles} data-cy={dataCy}>
<div

View file

@ -1 +1 @@
3.0.2-ce-lts
3.0.3-ce-lts

View file

@ -67,6 +67,13 @@ export const codeEditorConfig = {
exposedVariables: {
value: '',
},
actions: [
{
handle: 'setValue',
displayName: 'Set value',
params: [{ handle: 'setValue', defaultValue: '' }],
},
],
definition: {
others: {
showOnDesktop: { value: '{{true}}' },