codeant-ai-for-open-source[bot] commented on code in PR #35208:
URL: https://github.com/apache/superset/pull/35208#discussion_r3472621702
##########
superset-frontend/src/explore/components/controls/ViewQueryModal.tsx:
##########
@@ -48,38 +50,42 @@ const ViewQueryModalContainer = styled.div`
gap: ${({ theme }) => theme.sizeUnit * 4}px;
`;
-const ViewQueryModal: FC<Props> = ({ latestQueryFormData }) => {
+const ViewQueryModal: FC<Props> = ({ latestQueryFormData, ownState }) => {
const [result, setResult] = useState<Result[]>([]);
const [isLoading, setIsLoading] = useState(false);
const [error, setError] = useState<string | null>(null);
- const loadChartData = (resultType: string) => {
- setIsLoading(true);
- getChartDataRequest({
- formData: latestQueryFormData,
- resultFormat: 'json',
- resultType,
- })
- .then(({ json }) => {
- setResult(ensureIsArray(json.result) as Result[]);
- setIsLoading(false);
- setError(null);
+ const loadChartData = useCallback(
+ (resultType: string) => {
+ setIsLoading(true);
+ getChartDataRequest({
+ formData: latestQueryFormData,
+ resultFormat: 'json',
+ resultType,
+ ownState: ownState || {},
})
- .catch(response => {
- getClientErrorObject(response).then(({ error, message }) => {
- setError(
- error ||
- message ||
- response.statusText ||
- t('Sorry, An error occurred'),
- );
+ .then(({ json }) => {
+ setResult(ensureIsArray(json.result) as Result[]);
setIsLoading(false);
+ setError(null);
Review Comment:
✅ **Customized review instruction saved!**
**Instruction:**
> When a race-condition/cancellation issue originates in a shared request
helper or existing request pipeline, scope the review to the shared abstraction
or all affected call sites rather than treating it as a defect introduced by a
single modal change.
**Applied to:**
- `**/*.ts`
- `**/*.tsx`
---
💡 *To manage or update this instruction, visit: [CodeAnt AI
Settings](https://app.codeant.ai/org/settings/learnings)*
--
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]