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 prevent js crashes from null value in messages #7

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

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.

@@ -25,9 +25,11 @@ export const getMessages = (key = null) => {
* @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 {};

@@ -25,9 +25,11 @@ export const getMessages = (key = null) => {
* @returns {Object} The converted dictionary object
*/
export const createDictionary = (messages, prefix = "") => {
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