Merge pull request #26215 from appsmithorg/hotfix/v1.9.18.2

fix: HotFix (#26167) and (#26207)
This commit is contained in:
Nidhi 2023-08-10 04:49:09 +05:30 committed by GitHub
commit e8b6925dd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 46 additions and 8 deletions

View File

@ -0,0 +1,31 @@
import { ObjectsRegistry } from "../../../../support/Objects/Registry";
const dataSources = ObjectsRegistry.DataSources,
agHelper = ObjectsRegistry.AggregateHelper,
ee = ObjectsRegistry.EntityExplorer;
describe("Fix UQI query switching", function () {
it("The command of the query must be preserved and should not default to initial value after changed.", function () {
dataSources.NavigateToDSCreateNew();
dataSources.CreateDataSource("Mongo", false, false);
dataSources.CreateQueryAfterDSSaved("", "MongoQuery");
dataSources.ValidateNSelectDropdown(
"Commands",
"Find document(s)",
"Insert document(s)",
);
dataSources.NavigateToDSCreateNew();
dataSources.CreateDataSource("S3", false, false);
dataSources.CreateQueryAfterDSSaved("", "S3Query");
dataSources.ValidateNSelectDropdown(
"Commands",
"List files in bucket",
"Create a new file",
);
ee.SelectEntityByName("MongoQuery", "Queries/JS");
dataSources.ValidateNSelectDropdown("Commands", "Insert document(s)");
ee.SelectEntityByName("S3Query", "Queries/JS");
dataSources.ValidateNSelectDropdown("Commands", "Create a new file");
});
});

View File

@ -201,13 +201,8 @@ function renderDropdown(
});
if (selectedValue !== tempSelectedValues) {
// when pre-selected value is not found in dropdown options,
// initializing dropdown to initial value instead of blank
const tempValues = !isNil(props?.initialValue)
? (props.initialValue as string[])
: tempSelectedValues;
selectedValue = tempValues;
props.input?.onChange(tempValues);
selectedValue = tempSelectedValues;
props.input?.onChange(tempSelectedValues);
}
const isOptionDynamic = options.some((opt) => "disabled" in opt);

View File

@ -73,6 +73,18 @@ describe("emptyChartData", () => {
props.chartData.seriesID1 = { data: [] };
expect(emptyChartData(props)).toEqual(false);
});
it("returns true if chart data isn't present", () => {
const props = JSON.parse(JSON.stringify(defaultProps));
props.chartType = "LINE_CHART";
props.chartData = null;
expect(emptyChartData(props)).toEqual(true);
props.chartData = {
seriesID1: {},
};
expect(emptyChartData(props)).toEqual(true);
});
});
describe("when chart type is custom fusion charts", () => {

View File

@ -31,7 +31,7 @@ export const emptyChartData = (props: ChartWidgetProps) => {
}
} else {
for (const seriesID in props.chartData) {
if (props.chartData[seriesID].data.length > 0) {
if (props.chartData[seriesID].data?.length > 0) {
return false;
}
}