Conversation
| const [prevFirstContentFieldValue, setPrevFirstContentFieldValue] = | ||
| useState(null); | ||
| const languages = useSelector((state) => state.languages); | ||
| const contentItems = useSelector((state) => state.content); |
There was a problem hiding this comment.
This is a pretty significant selector that will cause the whole Editor to re-render on content change. We should move it as low as possible in the component tree
There was a problem hiding this comment.
removed contentItems selector
| <div className={styles.Fields}> | ||
| {activeFields?.map((field) => { | ||
| const fieldItem = contentItems?.[item?.data?.[field.name]]; | ||
| const fieldValue = ["one_to_one", "one_to_many"].includes( |
There was a problem hiding this comment.
Related to previous comment. Would it not be a better idea to add this business logic in the relationship field component itself specifically in these types case blocks? since it only relates to specific field types and is much lower in the component tree
There was a problem hiding this comment.
Agreed. That's a much better approach. I've moved the locale-update logic into the relationship field component as suggested.
| @@ -1,5 +1,5 @@ | |||
| import { memo, useCallback, useEffect, useMemo, useState } from "react"; | |||
| import { useDispatch } from "react-redux"; | |||
| import { useDispatch, useSelector } from "react-redux"; | |||
| ]); | ||
|
|
||
| useEffect(() => { | ||
| updateItemLocale(); |
There was a problem hiding this comment.
This seems like a very hacky solution to this. If im reading this correctly you are changing the content's state and then manually unmarking it as dirty on mount? Are we also changing values? If so why? We should not be doing any kind of content change that is not explicit by the user
A more holistic solution is when switching locale the value of the initial state should reflect the locale.
There was a problem hiding this comment.
The content of all locale items will be identical, as they inherit the same content upon creation.
I’m not sure if we have control over that behavior on the frontend.
|
Based on discussions @geodem127 we should close or mark the pr as draft. Don't want this accidentally merged in |
Root Cause:
The relational field inherits the language selection from when the source item was originally created.
Fix:
Implemented logic to retrieve content items localized to the currently selected language.
Loom.Message.-.22.October.2025.1.mp4