@bento-core/table 1.0.1-ccdihub.112 → 1.0.1-ccdihub.114

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -229,8 +229,12 @@ const CPIModal = _ref => {
229
229
  const participantId = row.participant_id;
230
230
  const studyId = row.study_id;
231
231
  (0, _react.useEffect)(() => {
232
- setData(row.cpi_data);
233
- }, [row]);
232
+ // Reset all state when row or open status changes
233
+ setData(row.cpi_data || []);
234
+ setIds([]);
235
+ setSelectAll(false);
236
+ setDropdownOpen(false);
237
+ }, [row, open]);
234
238
  const handleDropdownToggle = () => {
235
239
  setDropdownOpen(!dropdownOpen);
236
240
  };
@@ -637,7 +641,6 @@ const CPIModal = _ref => {
637
641
  }))), /*#__PURE__*/_react.default.createElement(_core.Button, {
638
642
  style: viewInExploreButton,
639
643
  onClick: () => {
640
- onClose();
641
644
  window.location.href = "/explore?p_id=".concat(participantId, "&dbgap_accession=").concat(studyId);
642
645
  },
643
646
  disableRipple: true
@@ -679,8 +682,8 @@ const CPIModal = _ref => {
679
682
  }, /*#__PURE__*/_react.default.createElement(_core.Button, {
680
683
  style: goToCartButton,
681
684
  onClick: () => {
682
- onClose();
683
685
  window.location.href = '/fileCentricCart';
686
+ setDropdownOpen(false);
684
687
  },
685
688
  disableRipple: true
686
689
  }, "GO TO CART"))))))), /*#__PURE__*/_react.default.createElement("div", {
@@ -94,6 +94,7 @@ const CPIView = _ref => {
94
94
  return /*#__PURE__*/_react.default.createElement(_core.Typography, {
95
95
  className: _Types.cellTypes.CPI
96
96
  }, row[column === null || column === void 0 ? void 0 : column.dataField], cpiData.length ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_CPIModal.default, {
97
+ key: "".concat(row.id, "-").concat(row.participant_id),
97
98
  row: row,
98
99
  open: modalOpen,
99
100
  onClose: handleModalClose,
@@ -107,6 +107,8 @@ const CPIFilesComponent = props => {
107
107
  */
108
108
  const addAllFiles = () => {
109
109
  let toAdd = [];
110
+ console.log('participantIds', participantIds);
111
+ console.log('rowID', rowID);
110
112
  if (btnType === 'ADD_ALL_FILES') {
111
113
  participantIds.forEach(e => {
112
114
  if (e.data_type === 'internal' && e.p_id) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bento-core/table",
3
- "version": "1.0.1-ccdihub.112",
3
+ "version": "1.0.1-ccdihub.114",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "build": "npm run lint && cross-env-shell rm -rf dist && NODE_ENV=production BABEL_ENV=es babel src --out-dir dist --copy-files",
@@ -237,8 +237,12 @@ const CPIModal = ({
237
237
  const studyId = row.study_id;
238
238
 
239
239
  useEffect(() => {
240
- setData(row.cpi_data);
241
- }, [row]);
240
+ // Reset all state when row or open status changes
241
+ setData(row.cpi_data || []);
242
+ setIds([]);
243
+ setSelectAll(false);
244
+ setDropdownOpen(false);
245
+ }, [row, open]);
242
246
 
243
247
  const handleDropdownToggle = () => {
244
248
  setDropdownOpen(!dropdownOpen);
@@ -681,7 +685,6 @@ const CPIModal = ({
681
685
  <Button
682
686
  style={viewInExploreButton}
683
687
  onClick={() => {
684
- onClose();
685
688
  window.location.href = `/explore?p_id=${participantId}&dbgap_accession=${studyId}`;
686
689
  }}
687
690
  disableRipple
@@ -734,8 +737,8 @@ const CPIModal = ({
734
737
  <Button
735
738
  style={goToCartButton}
736
739
  onClick={() => {
737
- onClose();
738
740
  window.location.href = '/fileCentricCart';
741
+ setDropdownOpen(false);
739
742
  }}
740
743
  disableRipple
741
744
  >
@@ -102,6 +102,7 @@ const CPIView = ({
102
102
  ? (
103
103
  <>
104
104
  <CPIModal
105
+ key={`${row.id}-${row.participant_id}`}
105
106
  row={row}
106
107
  open={modalOpen}
107
108
  onClose={handleModalClose}
@@ -109,6 +109,8 @@ const CPIFilesComponent = (props) => {
109
109
  */
110
110
  const addAllFiles = () => {
111
111
  let toAdd = [];
112
+ console.log('participantIds', participantIds);
113
+ console.log('rowID', rowID);
112
114
  if (btnType === 'ADD_ALL_FILES') {
113
115
  participantIds.forEach((e) => {
114
116
  if (e.data_type === 'internal' && e.p_id) {