Skip to content

fix(chart list): Facepile shows correct users when saving chart properties #33392

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ethan-l-geotab
Copy link

SUMMARY

Looking to fix: #31592.
It's reproducible on all the test-env up environments. Add "Superset Admin" as user on a chart and then save shows the undefined undefined.

I just update the redux with the owner list back in it's original "shape".

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

first half is the broken, second half is working
fix-chart-list

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

Copy link

korbit-ai bot commented May 8, 2025

Based on your review schedule, I'll hold off on reviewing this PR until it's marked as ready for review. If you'd like me to take a look now, comment /korbit-review.

Your admin can change your review schedule in the Korbit Console

@ethan-l-geotab
Copy link
Author

/korbit-review.

Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review by Korbit AI

Korbit automatically attempts to detect when you fix issues in new commits.
Category Issue Status
Functionality Unsafe Name Splitting Logic ▹ view ✅ Fix detected
Performance Inefficient Owner Name Transformation ▹ view 🧠 Not in scope
Files scanned
File Path Reviewed
superset-frontend/src/explore/components/PropertiesModal/index.tsx

Explore our documentation to understand the languages and file types we support and the files we ignore.

Check out our docs on how you can make Korbit work best for you and your team.

Loving Korbit!? Share us on LinkedIn Reddit and X

Comment on lines 189 to 197
const selectedOwnersArray = ensureIsArray(selectedOwners);
const newOwners = selectedOwnersArray.map((owner: any) => {
const [first_name, ...last_name_parts] = owner.label.split(' ');
return {
id: owner.value,
first_name,
last_name: last_name_parts.join(' '),
};
});

This comment was marked as resolved.

// convert the tags to the format used in the selectOwners back to original redux format
const selectedOwnersArray = ensureIsArray(selectedOwners);
const newOwners = selectedOwnersArray.map((owner: any) => {
const [first_name, ...last_name_parts] = owner.label.split(' ');

This comment was marked as resolved.

@ethan-l-geotab ethan-l-geotab marked this pull request as ready for review May 8, 2025 18:03
@dosubot dosubot bot added the explore:save Related to saving changes in Explore label May 8, 2025
Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review by Korbit AI

Korbit automatically attempts to detect when you fix issues in new commits.
Category Issue Status
Readability Complex Name Parsing Without Types ▹ view 🧠 Not in scope
Design Embedded Name Parsing Logic ▹ view 🧠 Not in scope
Files scanned
File Path Reviewed
superset-frontend/src/explore/components/PropertiesModal/index.tsx

Explore our documentation to understand the languages and file types we support and the files we ignore.

Check out our docs on how you can make Korbit work best for you and your team.

Loving Korbit!? Share us on LinkedIn Reddit and X

Comment on lines 190 to 200
const newOwners = selectedOwnersArray.map((owner: any) => {
const nameParts = owner.label.split(' ');
const first_name = nameParts[0] || '';
const last_name = nameParts.length > 1 ? nameParts.slice(1).join(' ') : '';
return {
id: owner.value,
first_name,
last_name,
};
});

This comment was marked as resolved.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's a pretty specific case where this one component handles owners in a specific way which when trying to update redux, the "shape" of the object is different, so i have to translate it back to the same shape which originally existed.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see - since this is specifically about matching the Redux state shape in this component, keeping the transformation logic local makes sense. Thanks for clarifying the context.

Comment on lines 191 to 193
const nameParts = owner.label.split(' ');
const first_name = nameParts[0] || '';
const last_name = nameParts.length > 1 ? nameParts.slice(1).join(' ') : '';

This comment was marked as resolved.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably OK, but I'm slightly nervous about things like middle names. This would mean if we have Michael J. Fox sign up, it'd be "Michael" "J. Fox" instead of "Michael J." "Fox."

Is there other first/last name logic currently in place, or is this a new concept?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valid concern about middle name handling. Before suggesting changes, could you clarify if there's existing first/last name parsing logic elsewhere in the codebase we should match? If so, we should reuse that pattern instead of introducing a new one.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about that too actually. "Updating" only happens around user ID's. As for display, I'm on the same line as you where it's "probably okay".

There is no real existing "full_name" split. I tried checking out how dashboards/dataset list handles it, but they're both different :(.

I dont think there is a true way of doing it unless we retrieve it from the backend.

I have tried doing something like this in the backend to "pass ownership data" along with the put request
and then just removing the modification to the owner field and using just the returned owner from the put request, but I'm not sure that's the best design either...
image
image

I've also tried seeing if I could sort of "cache" the load options and see if it was split there when im getting the eligible users to add as owners, but that won't work either because it's only item.text and makes no differentiation of first and last names.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no real existing "full_name" split. I tried checking out how dashboards/dataset list handles it, but they're both different :(.

This is what I was worried about. If there's any logic to be DRY'd up (moved to a util or something) that would be preferable than implementing another bit of inline logic.

@rusackas rusackas added the review:checkpoint Last PR reviewed during the daily review standup label May 9, 2025
@rusackas rusackas requested review from kgabryje and EnxDev May 9, 2025 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
explore:save Related to saving changes in Explore review:checkpoint Last PR reviewed during the daily review standup size/S
Projects
None yet
Development

Successfully merging this pull request may close these issues.

In chart management, editing any chart properties may result in incorrect updates to the owner badge list
2 participants