Skip to content

Conversation

@akolson
Copy link
Member

@akolson akolson commented Oct 10, 2025

Summary

This pr adds a defensive on the code for the error reported in sentry as detailed here. The bug is triggered when trying to edit multiple resources with differing languages.

References

Fixes #5434

Reviewer guidance

  • Use any of the LanguageDropdowns in any of the pages in studio
  • Ensure no regressions in behavior
  • Check logs to ensure above logs are not reported
  • Regression tests have also been added, so should pass.

@akolson akolson added this to the Studio: October 2025 Patches milestone Oct 10, 2025
@akolson akolson added P2 - normal Priority: Nice to have and removed P1 - important Priority: High impact on UX labels Oct 10, 2025
languageText(item) {
const firstNativeName = item.native_name.split(',')[0].trim();
const nativeName = item?.native_name || '';
const firstNativeName = nativeName.split(',')[0].trim();
Copy link
Member

Choose a reason for hiding this comment

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

I think similarly to the node title defensive check, we should be trying to understand why this is happening and whether it's indicative of another issue. I imported shared/leUtils/Languages.js in a Node REPL and all of them had a native_name.

> Array.from(LanguagesMap.values()).filter(l => !l.native_name)
[]

Also, in the Studio database, all languages have it too.
image

Copy link
Member Author

Choose a reason for hiding this comment

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

The bug is triggered when trying to edit multiple resources with differing languages. In such cases, and empty object ({}) is returned, thus the bug. The above should be an acceptable fix, I think. However, I have posted here for designers to have their thoughts on UX.

Copy link
Member

Choose a reason for hiding this comment

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

We'll see what design says. If they prefer to keep it as is, perhaps we can use a Symbol to explicitly handle this situation, which will be specific enough that we wouldn't suppress any other possible issues.

Copy link
Member Author

Choose a reason for hiding this comment

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

Based on designs recommendation, a "new" language "Mixed (Mix)" will be added Languages.vue. The wording could change after string review but should be sufficient for now.

Copy link
Member Author

Choose a reason for hiding this comment

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

Update: Looks like we don't need to add a new type afterall. We already have "Multiple languages (mull)" option in places.

@bjester bjester self-assigned this Oct 21, 2025
@akolson akolson changed the title Adds defensive check when generating language text in the language dr… Adds defensive check when generating language text in the language dropdown Oct 30, 2025
@akolson akolson requested a review from bjester October 30, 2025 06:26
@akolson
Copy link
Member Author

akolson commented Oct 30, 2025

@bjester I think we should be good here. Noting here that the display of the Multple languages option is cosmetic and no saving is done.

Copy link
Member

@bjester bjester left a comment

Choose a reason for hiding this comment

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

Left some comments based off my understanding of the code and the UX behavior, but I didn't actually test it. Let me know if I misinterpreted anything.

@akolson akolson requested a review from bjester November 3, 2025 15:55
@akolson
Copy link
Member Author

akolson commented Nov 3, 2025

@bjester I think we should be good. Thanks for the recommendations--all made sense to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants