Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix [DEV-9150] Fix double chart request #1971

Merged
merged 1 commit into from
Mar 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 1 addition & 22 deletions packages/chart/src/CdcChart.tsx
Original file line number Diff line number Diff line change
@@ -69,12 +69,7 @@ const CdcChartWrapper: React.FC<CdcChartProps> = ({ configUrl, isEditor, isDebug
setIsLoading(true)
try {
const loadedConfig = await loadConfig(configUrl)
const data = await loadDataFromConfig(loadedConfig)

setConfig({
...loadedConfig,
data
})
setConfig(loadedConfig)
} catch (error) {
console.error('Failed to load configuration or data', error)
} finally {
@@ -124,19 +119,3 @@ const fetchAndParseData = async (url: string, ext: string) => {
return []
}
}

const loadDataFromConfig = async (response: any) => {
if (!response.dataUrl || _.some(_.get(response, 'filters', []), { type: 'url' })) {
return response.data || []
}

const ext = getFileExtension(response.dataUrl)
const urlWithCacheBuster = `${response.dataUrl}`

try {
return await fetchAndParseData(urlWithCacheBuster, ext)
} catch {
console.error(`Cannot parse URL: ${response.dataUrl}`)
return []
}
}
Loading