react-bootstrap-table2 icon indicating copy to clipboard operation
react-bootstrap-table2 copied to clipboard

Warning: Using UNSAFE_componentWillReceiveProps

Open rlutsky042919 opened this issue 4 years ago • 2 comments

Describe the bug got this error in console: Warning: Using UNSAFE_componentWillReceiveProps in strict mode is not recommended and may indicate bugs in your code. See https://reactjs.org/link/unsafe-component-lifecycles for details.

  • Move data fetching code or side effects to componentDidUpdate.
  • If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://reactjs.org/link/derived-state

Please update the following components: EditingCell

To Reproduce Steps to reproduce the behavior:

  1. install both import BootstrapTable from 'react-bootstrap-table-next'; import cellEditFactory, { Type } from 'react-bootstrap-table2-editor'; 2.set up Bootstrap Table component as return ( <BootstrapTable keyField='id'
    data={ rows } columns={ columns } bootstrap4={true} // striped noDataIndication={noDataIndication} hover // rowEvents={rowEvents} selectRow={ selectRow } cellEdit={cellEdit} /> );

  2. Set up functions to handle row selection and checkboxes: function handleOnSelect(row, isSelect, rowIndex, e, id) { console.log("ROW ID: ", id) if (isSelect === true) { setSelectedStrategy(() => ({ ...selectedStrategy, id}));

    } else { setSelectedStrategy(() => (selectedStrategy.filter(x => x !== row.id) )); } }

function handleOnSelectAll(isSelect, rows){ const ids = rows.map(r => r.id); if (isSelect) { setSelectedStrategy(() => ({ selectedStrategy: ids })); } else { setSelectedStrategy(() => ({ selectedStrategy: [] })); } }

const selectRow = { mode: 'checkbox', clickToSelect: true, clickToEdit: true, onSelect: handleOnSelect, onSelectAll: handleOnSelectAll // Click to edit cell also } const cellEdit = cellEditFactory({ mode: 'click', blurToSave: true, selectionRenderer: ({ mode, rowIndex, ...rest }) => ( <input type={mode} id={row${rowIndex + 1}} {...rest} /> ),

}) `` 4. See error image

  1. also see that ALL checkboxes are checked whenever click into ANY row.
    codesandbox Please give a simple and minimal example on https://codesandbox.io so that we can reproduce it easily and handle it effectively

Is the Editing Cell warning causing the issues with the checkboxes? I am really liking the library so far.

rlutsky042919 avatar Dec 30 '20 22:12 rlutsky042919

+1

jslmariano avatar Nov 22 '21 12:11 jslmariano

Duplicates #1308.

isherwood avatar Jan 11 '22 21:01 isherwood