nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: gregnb/mui-datatables
Pull request #896 (2019-09-04 22:19:41)

Bugfix/Issue 365
Fix regression with certain options being overridden improperly.

coveralls: 
[![Coverage Status](https://coveralls.io/builds/25535008/badge)](https://coveralls.io/builds/25535008)

Coverage decreased (-0.02%) to 76.408% when pulling **e021001b290cc109fc3f78ea690c59a8442417b2 on bugfix/issue-365-options-regression** into **b61d06a26becf9b98b65afc4fc8b4882f402e5ba on master**.


Patch:
diff --git a/src/MUIDataTable.js b/src/MUIDataTable.js
index 00e4b92..3d7eda6 100644
--- a/src/MUIDataTable.js
+++ b/src/MUIDataTable.js
@@ -237,7 +237,7 @@ class MUIDataTable extends React.Component {
 
   componentDidUpdate(prevProps) {
     if (this.props.data !== prevProps.data || this.props.columns !== prevProps.columns) {
-      this.updateOptions(this.props);
+      this.updateOptions(this.options, this.props);
       this.setTableData(this.props, TABLE_LOAD.INITIAL, () => {
         this.setTableAction('propsUpdate');
       });
@@ -254,8 +254,8 @@ class MUIDataTable extends React.Component {
     }
   }
 
-  updateOptions(props) {
-    this.options = assignwith(this.options, props.options, (objValue, srcValue, key) => {
+  updateOptions(options, props) {
+    this.options = assignwith(options, props.options, (objValue, srcValue, key) => {
       // Merge any default options that are objects, as they will be overwritten otherwise
       if (key === 'textLabels' || key === 'downloadOptions') return merge(objValue, srcValue);
       return;
@@ -325,9 +325,7 @@ class MUIDataTable extends React.Component {
   mergeDefaultOptions(props) {
     const defaultOptions = this.getDefaultOptions();
 
-    this.options = merge(defaultOptions, props.options);
-
-    this.handleOptionDeprecation(props);
+    this.updateOptions(defaultOptions, this.props);
   }
 
   validateOptions(options) {


Test patch:
diff --git a/test/MUIDataTable.test.js b/test/MUIDataTable.test.js
index 6d157be..7d4bed0 100644
--- a/test/MUIDataTable.test.js
+++ b/test/MUIDataTable.test.js
@@ -496,6 +496,16 @@ describe('<MUIDataTable />', function() {
     assert.deepEqual(state.rowsPerPageOptions, [5, 10, 15]);
   });
 
+  it('should allow empty array rowsPerPageOptions when provided in options', () => {
+    const options = {
+      rowsPerPageOptions: [],
+    };
+
+    const shallowWrapper = shallow(<MUIDataTable columns={columns} data={data} options={options} />);
+    const state = shallowWrapper.dive().state();
+    assert.deepEqual(state.rowsPerPageOptions, []);
+  });
+
   it('should render pagination when enabled in options', () => {
     const options = {
       pagination: true,