Skip to content

Fix prevent js crashes from null value in messages#7

Open
rsdeus wants to merge 1 commit intodevelopfrom
chore/prevent_js_crashes_from_null_value
Open

Fix prevent js crashes from null value in messages#7
rsdeus wants to merge 1 commit intodevelopfrom
chore/prevent_js_crashes_from_null_value

Conversation

@rsdeus
Copy link
Member

@rsdeus rsdeus commented Nov 18, 2024

🎩 What? Why?

When there is a null value in var messages, the i18n.js script crashes, the WYSIWYG editor doesn't show up, and the textarea becomes disabled.

📌 Related Issues

Link your PR to an issue

Testing

📷 Screenshots

image

♥️ Thank you!

@rsdeus rsdeus requested a review from froger November 18, 2024 13:17
@rsdeus rsdeus self-assigned this Nov 18, 2024
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This pull request does not contain a valid label. Please add one of the following labels: ['type: feature', 'type: change', 'type: fix', 'type: removal', 'target: developer-experience', 'type: internal']

Copy link
Member

@froger froger left a comment

Choose a reason for hiding this comment

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

Hi @rsdeus, here my suggestions to pass the npm run lint linter.

* @returns {Object} The converted dictionary object
*/
export const createDictionary = (messages, prefix = "") => {
if (!messages) return {};
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (!messages) return {};

if (!messages) return {};

let final = {};
Object.keys(messages).forEach((key) => {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Object.keys(messages).forEach((key) => {
Object.keys(messages || {}).forEach((key) => {

@rsdeus rsdeus changed the title chore: prevent js crashes from null value in messages Fix prevent js crashes from null value in messages Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants