You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by va...@apache.org on 2025/07/05 22:15:12 UTC
(superset) 01/01: chore: Improve performance to load the chart properties modal
This is an automated email from the ASF dual-hosted git repository.
vavila pushed a commit to branch chore/load-chart-properties
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 5445c515f11094babbcc4291a278a05f1365298c
Author: Vitor Avila <vi...@preset.io>
AuthorDate: Sat Jul 5 19:14:37 2025 -0300
chore: Improve performance to load the chart properties modal
---
.../explore/components/PropertiesModal/index.tsx | 45 ++++++++++------------
1 file changed, 21 insertions(+), 24 deletions(-)
diff --git a/superset-frontend/src/explore/components/PropertiesModal/index.tsx b/superset-frontend/src/explore/components/PropertiesModal/index.tsx
index e66bd77025..a7ea8ddfa1 100644
--- a/superset-frontend/src/explore/components/PropertiesModal/index.tsx
+++ b/superset-frontend/src/explore/components/PropertiesModal/index.tsx
@@ -101,11 +101,21 @@ function PropertiesModal({
});
}
- const fetchChartOwners = useCallback(
- async function fetchChartOwners() {
+ const fetchChartProperties = useCallback(
+ async function fetchChartProperties() {
+ const queryParams = rison.encode({
+ select_columns: [
+ 'owners.id',
+ 'owners.first_name',
+ 'owners.last_name',
+ 'tags.id',
+ 'tags.name',
+ 'tags.type',
+ ],
+ });
try {
const response = await SupersetClient.get({
- endpoint: `/api/v1/chart/${slice.slice_id}`,
+ endpoint: `/api/v1/chart/${slice.slice_id}?q=${queryParams}`,
});
const chart = response.json.result;
setSelectedOwners(
@@ -114,6 +124,12 @@ function PropertiesModal({
label: `${owner.first_name} ${owner.last_name}`,
})),
);
+ if (isFeatureEnabled(FeatureFlag.TaggingSystem)) {
+ const customTags = chart.tags?.filter(
+ (tag: TagType) => tag.type === 1,
+ );
+ setTags(customTags);
+ }
} catch (response) {
const clientError = await getClientErrorObject(response);
showError(clientError);
@@ -206,33 +222,14 @@ function PropertiesModal({
// get the owners of this slice
useEffect(() => {
- fetchChartOwners();
- }, [fetchChartOwners]);
+ fetchChartProperties();
+ }, [slice.slice_id]);
// update name after it's changed in another modal
useEffect(() => {
setName(slice.slice_name || '');
}, [slice.slice_name]);
- useEffect(() => {
- if (!isFeatureEnabled(FeatureFlag.TaggingSystem)) return;
- try {
- fetchTags(
- {
- objectType: OBJECT_TYPES.CHART,
- objectId: slice.slice_id,
- includeTypes: false,
- },
- (tags: TagType[]) => setTags(tags),
- error => {
- showError(error);
- },
- );
- } catch (error) {
- showError(error);
- }
- }, [slice.slice_id]);
-
const handleChangeTags = (tags: { label: string; value: number }[]) => {
const parsedTags: TagType[] = ensureIsArray(tags).map(r => ({
id: r.value,