Skip to content

Commit

Permalink
Fixed: Translations for columns
Browse files Browse the repository at this point in the history
(cherry picked from commit 6d53d2a153a98070c42d0619c15902b6bd5dfab4)

Closes #2702
  • Loading branch information
markus101 authored and mynameisbogdan committed Aug 11, 2023
1 parent f03fd7e commit b319a4b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
4 changes: 2 additions & 2 deletions frontend/src/Components/Icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Icon extends PureComponent {
return (
<span
className={containerClassName}
title={title}
title={typeof title === 'function' ? title() : title}
>
{icon}
</span>
Expand All @@ -58,7 +58,7 @@ Icon.propTypes = {
name: PropTypes.object.isRequired,
kind: PropTypes.string.isRequired,
size: PropTypes.number.isRequired,
title: PropTypes.string,
title: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
isSpinning: PropTypes.bool.isRequired,
fixedWidth: PropTypes.bool.isRequired
};
Expand Down
15 changes: 11 additions & 4 deletions frontend/src/Store/Middleware/createPersistState.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,17 @@ function mergeColumns(path, initialState, persistedState, computedState) {
const column = initialColumns.find((i) => i.name === persistedColumn.name);

if (column) {
columns.push({
...column,
isVisible: persistedColumn.isVisible
});
const newColumn = {};

// We can't use a spread operator or Object.assign to clone the column
// or any accessors are lost and can break translations.
for (const prop of Object.keys(column)) {
Object.defineProperty(newColumn, prop, Object.getOwnPropertyDescriptor(column, prop));
}

newColumn.isVisible = persistedColumn.isVisible;

columns.push(newColumn);
}
});

Expand Down

0 comments on commit b319a4b

Please sign in to comment.