Skip to content

Commit

Permalink
#4297 Dynamic load of rules grid to split code for react-data-grid-ad…
Browse files Browse the repository at this point in the history
…dons (#6692)
  • Loading branch information
offtherailz authored Mar 24, 2021
1 parent 9422c15 commit fc50e60
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions web/client/plugins/RulesDataGrid.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
*/

import PropTypes from 'prop-types';
import React from 'react';
import React, { Suspense } from 'react';
import LoadingView from '../components/misc/LoadingView';

import ContainerDimensions from 'react-container-dimensions';
import { connect } from 'react-redux';
import { compose } from 'recompose';
Expand All @@ -16,10 +18,9 @@ import { createSelector } from 'reselect';
import { error } from '../actions/notifications';
import { rulesSelected, setFilter, setLoading } from '../actions/rulesmanager';
import rulesgridComp from '../components/manager/rulesmanager/rulesgrid/enhancers/rulesgrid';
import RulesGridComp from '../components/manager/rulesmanager/rulesgrid/RulesGrid';
import rulesmanager from '../reducers/rulesmanager';
import { filterSelector, isEditorActive, selectedRules, triggerLoadSel } from '../selectors/rulesmanager';

const RulesGridComp = React.lazy(() => import('../components/manager/rulesmanager/rulesgrid/RulesGrid'));
const ruelsSelector = createSelector([selectedRules, filterSelector, triggerLoadSel], (rules, filters, triggerLoad) => {
return {
selectedIds: rules.map(r => r.id),
Expand Down Expand Up @@ -58,7 +59,9 @@ class RulesDataGrid extends React.Component {
return (<ContainerDimensions>{({width, height}) =>
(<div className={`rules-data-gird ${this.props.enabled ? "" : "hide-locked-cell"}`}>
{!this.props.enabled && (<div className="ms-overlay"/>)}
<RulesGrid width={width} height={height}/>
<Suspense fallback={<LoadingView />}>
<RulesGrid width={width} height={height}/>
</Suspense>
</div>)
}
</ContainerDimensions>);
Expand Down

0 comments on commit fc50e60

Please sign in to comment.