Skip to content

Commit

Permalink
Fix mobx regression causing error in development build (sulu#5455)
Browse files Browse the repository at this point in the history
  • Loading branch information
danrot authored Aug 17, 2020
1 parent b765ed3 commit bd876de
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow
import {observer} from 'mobx-react';
import {action, computed} from 'mobx';
import {action, computed, toJS} from 'mobx';
import React, {Fragment} from 'react';
import ToolbarComponent from '../../components/Toolbar';
import Snackbar from '../../components/Snackbar';
Expand Down Expand Up @@ -153,7 +153,11 @@ class Toolbar extends React.Component<ToolbarProps> {
<ToolbarComponent.Controls>
{iconsConfig.length > 0 &&
<ToolbarComponent.Icons>
{iconsConfig.map((icon) => icon)}
{iconsConfig.map((icon) => {
// TODO this creates a deep copy and has a performance impact.
// Would be better to return functional components in withToolbar.
return toJS(icon);
})}
</ToolbarComponent.Icons>
}
{!!localeConfig &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export type ToolbarConfig = {
backButton?: Button,
disableAll?: boolean,
errors?: Array<string>,
icons?: Array<Node>,
icons?: Array<Node>, // TODO would be better to be typed as Array<React.ComponentType>
items?: Array<ToolbarItemConfig<*>>,
locale?: Select<string>,
showSuccess?: IObservableValue<boolean>,
Expand Down

0 comments on commit bd876de

Please sign in to comment.