codeant-ai-for-open-source[bot] commented on code in PR #44148:
URL: https://github.com/apache/superset/pull/44148#discussion_r4044695260
##########
superset-frontend/plugins/plugin-chart-country-map/src/CountryMap.ts:
##########
@@ -195,7 +199,13 @@ function CountryMap(element: HTMLElement, props:
CountryMapProps) {
dataMask: {
extraFormData: {
filters: values.length
- ? [{ col: entity, op: 'IN', val: values }]
+ ? [
+ {
+ col: entity,
+ op: 'IN',
+ val: values.map(sourceValue),
+ },
Review Comment:
**Suggestion:** The filter now sends source values but
`filterState.selectedValues` remains ISO codes, so existing source-value
filters are not highlighted or recognized as selected.
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Sometimes` ยท ๐ท๏ธ `Incorrect
condition logic`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=517d934c080a47c5af2d89e323764584&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=517d934c080a47c5af2d89e323764584&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
<details>
<summary><b>Prompt for AI Agent ๐ค </b></summary>
```mdx
This is a comment left during a code review.
**Path:**
superset-frontend/plugins/plugin-chart-country-map/src/CountryMap.ts
**Line:** 201:207
**Comment:**
*Incorrect Condition Logic: The filter now sends source values but
`filterState.selectedValues` remains ISO codes, so existing source-value
filters are not highlighted or recognized as selected.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44148&comment_hash=1a38f22bf9e489dbcaf72a8720d65097a7664ecb2751af21a19ffab45a070a79&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44148&comment_hash=1a38f22bf9e489dbcaf72a8720d65097a7664ecb2751af21a19ffab45a070a79&reaction=dislike'>๐</a>
##########
superset-frontend/plugins/plugin-chart-country-map/test/geographicRendering.test.tsx:
##########
@@ -0,0 +1,91 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { render, fireEvent } from '@testing-library/react';
+import d3 from 'd3';
+import { ChartProps } from '@superset-ui/core';
+import { supersetTheme } from '@apache-superset/core/theme';
+import ReactCountryMap from '../src/ReactCountryMap';
+import transformProps from '../src/transformProps';
+import fs from 'fs';
+import path from 'path';
+
+interface RegionFeature {
+ properties: { ISO: string };
+}
+
+const usa: { features: RegionFeature[] } = JSON.parse(
+ fs.readFileSync(path.join(__dirname, '../src/countries/usa.geojson'),
'utf8'),
+);
+
+test('typed state codes render real boundary paths and cross-filter original
values', () => {
+ const loader = d3 as unknown as {
+ json: (
+ url: string,
+ callback: (error: Error | null, data: unknown) => void,
+ ) => void;
+ };
+ const json = jest
+ .spyOn(loader, 'json')
+ .mockImplementation((_url, callback) => {
+ callback(null, usa);
+ });
+ const setDataMask = jest.fn();
+ try {
+ const props = transformProps(
+ new ChartProps({
+ theme: supersetTheme,
+ width: 800,
+ height: 600,
+ formData: {
+ entity: 'state',
+ metric: 'sales',
+ select_country: 'usa',
+ region_format: 'abbreviation',
Review Comment:
**Suggestion:** This test uses snake-case `region_format`, but
`transformProps` reads camel-case `regionFormat`, so normalization is skipped
and the non-gray rendering assertion fails.
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Often` ยท ๐ท๏ธ `Api mismatch`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=da356ef75e3d45d08646c9e713a7f9d7&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=da356ef75e3d45d08646c9e713a7f9d7&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
<details>
<summary><b>Prompt for AI Agent ๐ค </b></summary>
```mdx
This is a comment left during a code review.
**Path:**
superset-frontend/plugins/plugin-chart-country-map/test/geographicRendering.test.tsx
**Line:** 59:59
**Comment:**
*Api Mismatch: This test uses snake-case `region_format`, but
`transformProps` reads camel-case `regionFormat`, so normalization is skipped
and the non-gray rendering assertion fails.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44148&comment_hash=702b0de5c6abf6bdc4474de3ee0e2ee812239f6f560a92c8cb75fcff0fa4cfcc&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44148&comment_hash=702b0de5c6abf6bdc4474de3ee0e2ee812239f6f560a92c8cb75fcff0fa4cfcc&reaction=dislike'>๐</a>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]