Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

Commit

Permalink
- fetch actions after edit #2020
Browse files Browse the repository at this point in the history
- small cleanup
  • Loading branch information
siemiatj committed Oct 23, 2018
1 parent 388de6d commit a24d1b5
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 19 deletions.
4 changes: 2 additions & 2 deletions src/actions/WindowActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ import { getData, openFile, patchRequest } from './GenericActions';
import { initLayout } from '../api';
import { setListIncludedView } from './ListActions';
import { getWindowBreadcrumb } from './MenuActions';
import { getScope, toggleFullScreen } from '../utils';
import { parseToDisplay } from '../utils/documentListHelper';
import { toggleFullScreen } from '../utils';
import { getScope, parseToDisplay } from '../utils/documentListHelper';

export function setLatestNewDocument(id) {
return {
Expand Down
9 changes: 6 additions & 3 deletions src/components/app/DocumentList.js
Original file line number Diff line number Diff line change
Expand Up @@ -623,9 +623,12 @@ class DocumentList extends Component {
// END OF MANAGING SORT, PAGINATION, FILTERS -------------------------------

setTableRowEdited = val => {
this.setState({
rowEdited: val,
});
this.setState(
{
rowEdited: val,
},
() => this.updateQuickActions()
);
};

adjustWidth = () => {
Expand Down
32 changes: 18 additions & 14 deletions src/components/app/QuickActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class QuickActions extends Component {
dispatch: PropTypes.func.isRequired,

// from <DocumentList>
rows: ImmutablePropTypes.List.isRequired,
rows: ImmutablePropTypes.list,
childView: PropTypes.object.isRequired,
parentView: PropTypes.object.isRequired,
windowType: PropTypes.string.isRequired,
Expand All @@ -39,7 +39,7 @@ class QuickActions extends Component {
processStatus: PropTypes.string,
};

unmounted = false;
mounted = false;

constructor(props) {
super(props);
Expand All @@ -60,7 +60,7 @@ class QuickActions extends Component {
}

componentWillUnmount = () => {
this.unmounted = true;
this.mounted = false;
};

componentWillReceiveProps = nextProps => {
Expand All @@ -86,16 +86,9 @@ class QuickActions extends Component {
return nextProps.shouldNotUpdate !== true;
}

updateActions = (childSelection = this.props.childView.viewSelectedIds) => {
const { windowType, viewId, selected, childView, parentView } = this.props;
this.fetchActions(
windowType,
viewId,
selected,
{ ...childView, viewSelectedIds: childSelection },
parentView
);
};
componentDidMount = () => {
this.mounted = true;
}

componentDidUpdate = prevProps => {
const { inBackground, inModal } = this.props;
Expand All @@ -115,6 +108,17 @@ class QuickActions extends Component {
}
};

updateActions = (childSelection = this.props.childView.viewSelectedIds) => {
const { windowType, viewId, selected, childView, parentView } = this.props;
this.fetchActions(
windowType,
viewId,
selected,
{ ...childView, viewSelectedIds: childSelection },
parentView
);
};

handleClickOutside = () => {
this.toggleDropdown();
};
Expand Down Expand Up @@ -153,7 +157,7 @@ class QuickActions extends Component {
};

fetchActions = (windowType, viewId, selected, childView, parentView) => {
if (this.unmounted) {
if (!this.mounted) {
return;
}

Expand Down

0 comments on commit a24d1b5

Please sign in to comment.