Skip to content

Commit

Permalink
recalc the memo when the class changes to fix error on changing theme
Browse files Browse the repository at this point in the history
  • Loading branch information
foxriver76 committed Dec 19, 2023
1 parent b77649f commit 83585bc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,9 @@ E.g., if it was used in a menu and the menu is red, the circle would be red.
### **WORK IN PROGRESS**
-->
## Changelog
### **WORK IN PROGRESS**
* (foxriver76) fixed bug that no labels are shown for background

### 2.9.6 (2023-12-14)
* (foxriver76) fixed issues with the BulkEditor
* (foxriver76) scripts in HTML are now added to the DOM, instead of being executed in eval
Expand Down
21 changes: 6 additions & 15 deletions src/src/Attributes/View.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,17 +165,6 @@ const resolution = [
{ value: '1920x1080', label: 'Full HD - Landscape' },
];

/**
*
* @param item
* @param backgroundClass
* @return {JSX.Element}
*/
const renderPreview = (item, backgroundClass) => <>
<span className={`${backgroundClass} ${item.value}`} />
{I18n.t(item.label)}
</>;

const checkFunction = (funcText, settings) => {
try {
let _func;
Expand Down Expand Up @@ -226,8 +215,6 @@ const View = props => {
return null;
}

console.log(props.classes.backgroundClass);

const [triggerAllOpened, setTriggerAllOpened] = useState(0);
const [triggerAllClosed, setTriggerAllClosed] = useState(0);
const [showAllViewDialog, setShowAllViewDialog] = useState(null);
Expand Down Expand Up @@ -342,7 +329,11 @@ const View = props => {
type: 'select',
options: background,
field: 'background_class',
itemModify: item => renderPreview(item, props.classes.backgroundClassSquare),
// eslint-disable-next-line react/no-unstable-nested-components
itemModify: item => <>
<span className={`${props.classes.backgroundClass} ${item.value}`} />
{I18n.t(item.label)}
</>,
renderValue: value => <div className={props.classes.backgroundClass}>
<span className={`${props.classes.backgroundClassSquare} ${value}`} />
{I18n.t(background.find(item => item.value === value).label)}
Expand Down Expand Up @@ -745,7 +736,7 @@ const View = props => {
},
],
},
]), [resolutionSelect, `${view.settings.sizex}x${view.settings.sizey}`]);
]), [resolutionSelect, `${view.settings.sizex}x${view.settings.sizey}`, props.classes.backgroundClass, props.classes.backgroundClassSquare]);

const [accordionOpen, setAccordionOpen] = useState(
window.localStorage.getItem('attributesView')
Expand Down

0 comments on commit 83585bc

Please sign in to comment.