diff --git a/src/components/Container.js b/src/components/Container.js
index fe58c4ad2..0ea4f0120 100644
--- a/src/components/Container.js
+++ b/src/components/Container.js
@@ -112,19 +112,21 @@ class Container extends Component {
inModal={modal.visible}
>
- {includedView.windowType &&
- includedView.viewId &&
+ {includedView.windowType && includedView.viewId && (
- }
+ )}
}
diff --git a/src/components/app/DocumentList.js b/src/components/app/DocumentList.js
index 32bba244d..d9259eb48 100644
--- a/src/components/app/DocumentList.js
+++ b/src/components/app/DocumentList.js
@@ -65,6 +65,7 @@ class DocumentList extends Component {
isShowIncluded: false,
hasShowIncluded: false
}
+
this.fetchLayoutAndData();
}
@@ -186,7 +187,9 @@ class DocumentList extends Component {
this.setState({
cachedSelection: null
}, () => {
- dispatch(setListIncludedView());
+ if (includedView.windowType === 'pickingSlot') {
+ dispatch(setListIncludedView());
+ }
})
}
}
@@ -370,7 +373,7 @@ class DocumentList extends Component {
setNotFound && setNotFound(false);
dispatch(indicatorState('pending'));
- if(updateUri){
+ if (updateUri) {
id && updateUri('viewId', id);
page && updateUri('page', page);
sortingQuery && updateUri('sort', sortingQuery);
@@ -378,17 +381,31 @@ class DocumentList extends Component {
return browseViewRequest(
id, page, this.pageLength, sortingQuery, windowType
- ).then(response => {
- dispatch(indicatorState('saved'));
+ ).then( (response) => {
+ let selectionState = {};
+ let forceSelection = false;
+ if (
+ ((this.props.type === 'includedView') || this.props.isIncluded) &&
+ response.data && response.data.result && (response.data.result.length > 0)
+ ) {
+ selectionState.cachedSelection = null;
+ forceSelection = true;
+ }
- this.mounted && this.setState(Object.assign({}, {
- data: response.data,
- filters: response.data.filters
- }, refresh && {
- refresh: Date.now()
- }), () => {
- this.connectWS(response.data.viewId);
- })
+ this.mounted && this.setState(
+ Object.assign({}, {
+ data: response.data,
+ filters: response.data.filters
+ }, selectionState),
+ () => {
+ if (forceSelection) {
+ dispatch(selectTableItems([ response.data.result[0].id ], windowType))
+ }
+ this.connectWS(response.data.viewId);
+ }
+ );
+
+ dispatch(indicatorState('saved'));
});
}
@@ -539,9 +556,14 @@ class DocumentList extends Component {
/>}
{
+ const {
+ selected, viewId, windowType
+ } = this.props;
+
+ if (nextProps.selectedWindowType && (nextProps.selectedWindowType !== nextProps.windowType)) {
+ return;
+ }
+
+ if (
+ (nextProps.selected && (JSON.stringify(nextProps.selected) !== JSON.stringify(selected))) ||
+ (nextProps.viewId && (nextProps.viewId !== viewId)) ||
+ (nextProps.windowType && (nextProps.windowType !== windowType))
+ ) {
+ this.fetchActions(nextProps.windowType, nextProps.viewId, nextProps.selected);
+ }
+ }
+
+ shouldComponentUpdate(nextProps) {
+ return (nextProps.shouldNotUpdate !== true);
+ }
+
componentDidUpdate = (prevProps) => {
const {
- selected, refresh, shouldNotUpdate, viewId, selectedWindowType,
- windowType, inBackground, inModal
+ inBackground, inModal
} = this.props;
if (inModal === false && (prevProps.inModal === true)) {
@@ -66,22 +87,6 @@ class QuickActions extends Component {
loading: false
});
}
-
- if(shouldNotUpdate){
- return;
- }
-
- if(selectedWindowType && (selectedWindowType !== windowType)){
- return;
- }
-
- if(
- (JSON.stringify(prevProps.selected) !== JSON.stringify(selected)) ||
- (JSON.stringify(prevProps.refresh) !== JSON.stringify(refresh)) ||
- (JSON.stringify(prevProps.viewId) !== JSON.stringify(viewId))
- ){
- this.fetchActions();
- }
}
getChildContext = () => {
@@ -113,25 +118,32 @@ class QuickActions extends Component {
this.toggleDropdown();
}
- fetchActions = () => {
- const {windowType, viewId, selected} = this.props;
-
- this.mounted && this.setState({
+ fetchActions = (windowType, viewId, selected) => {
+/*
+ this.setState({
loading: true
});
-
- quickActionsRequest(windowType, viewId, selected)
- .then(response => {
- this.mounted && this.setState({
- actions: response.data.actions,
- loading: false
- })
- })
- .catch(() => {
- this.mounted && this.setState({
- loading: false
+*/
+
+ if (windowType && viewId && selected) {
+ quickActionsRequest(windowType, viewId, selected)
+ .then(response => {
+ this.setState({
+ actions: response.data.actions,
+ loading: false
+ })
})
+ .catch(() => {
+ this.setState({
+ loading: false
+ })
+ });
+ }
+ else {
+ this.setState({
+ loading: false
});
+ }
}
toggleDropdown = (option) => {