Skip to content

Commit

Permalink
fix: change title if there is a translation available
Browse files Browse the repository at this point in the history
  • Loading branch information
tedw87 committed Jun 28, 2023
1 parent 0ff1edc commit 4ab9421
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/ControlPanel/EditTaxonomy.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export default withRouter((props) => {

const [languageToShow, setLanguage] = React.useState(null);

const languages = languageToShow || [request?.default_language];
const languages = [languageToShow] || [request?.default_language];

const defaultLanguage = config.settings.languages.find(
(lang) => lang.code === request?.default_language,
Expand Down Expand Up @@ -337,14 +337,15 @@ export default withRouter((props) => {
placeholder="Title"
onChange={(event) => {
const name = event.target.value;

const newNode = changeNodeAtPath({
treeData,
path,
getNodeKey,
newNode: {
...node,
title: name,
...(languageToShow === defaultLanguage
? { title: name }
: {}),
translations: {
...node.translations,
[languageToShow]: name,
Expand Down

0 comments on commit 4ab9421

Please sign in to comment.