Skip to content

Commit

Permalink
chore: RulesEngineVerbose wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
eirikhaugstulen committed Dec 15, 2023
1 parent 5808152 commit e33c14a
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 19 deletions.
33 changes: 16 additions & 17 deletions src/components/App/App.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,25 @@ import React from 'react';
import { Provider } from 'react-redux';
import D2UIApp from '@dhis2/d2-ui-app';
import { AppContents } from './AppContents.component';
import { useRuleEngineFlags } from '../../core_modules/capture-core/rules/useRuleEngineFlags';
import {
RulesEngineVerboseInitializer,
} from '../../core_modules/capture-core/components/RulesEngineVerboseInitializer';

const MemoizedAppContents = React.memo(AppContents);

type Props = {
store: ReduxStore,
};

export const App = ({ store }: Props) => {
useRuleEngineFlags();

return (
<React.Fragment>
<Provider
store={store}
>
<D2UIApp>
<MemoizedAppContents />
</D2UIApp>
</Provider>
</React.Fragment>
);
};
export const App = ({ store }: Props) => (
<React.Fragment>
<Provider
store={store}
>
<D2UIApp>
<RulesEngineVerboseInitializer>
<AppContents />
</RulesEngineVerboseInitializer>
</D2UIApp>
</Provider>
</React.Fragment>
);
4 changes: 2 additions & 2 deletions src/components/App/AppContents.component.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

// @flow
import React from 'react';
import React, { memo } from 'react';
import { withStyles } from '@material-ui/core/styles';
import { systemSettingsStore } from 'capture-core/metaDataMemoryStores';
import { FeedbackBar } from 'capture-core/components/FeedbackBar';
Expand Down Expand Up @@ -30,4 +30,4 @@ const Index = ({ classes }: Props) => (
);
Index.displayName = 'AppContents';

export const AppContents = withStyles(getStyles)(Index);
export const AppContents = withStyles(getStyles)(memo(Index));
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// @flow
import { useRuleEngineFlags } from '../../rules/useRuleEngineFlags';

type Props = {|
children: React$Node,
|};
export const RulesEngineVerboseInitializer = ({ children }: Props) => {
useRuleEngineFlags();

return children;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// @flow
export { RulesEngineVerboseInitializer } from './RulesEngineVerboseInitializer';

0 comments on commit e33c14a

Please sign in to comment.