From a5fe54164e7fdeaf2f5730145cf1061423efc290 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Wed, 4 Aug 2021 09:30:53 -0700 Subject: [PATCH] IO-1285 Resolve production not saving sort order. --- ...uction-list-table-view-select.component.jsx | 7 +++++++ .../production-list-table.component.jsx | 18 ++++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/client/src/components/production-list-table/production-list-table-view-select.component.jsx b/client/src/components/production-list-table/production-list-table-view-select.component.jsx index 3cc78c102..f64d1121a 100644 --- a/client/src/components/production-list-table/production-list-table-view-select.component.jsx +++ b/client/src/components/production-list-table/production-list-table-view-select.component.jsx @@ -25,6 +25,7 @@ export function ProductionListTable({ currentUser, state, setColumns, + setState, }) { const { t } = useTranslation(); const [updateDefaultProdView] = useMutation(UPDATE_ACTIVE_PROD_LIST_VIEW); @@ -43,6 +44,10 @@ export function ProductionListTable({ }; }) ); + setState( + bodyshop.production_config.filter((pc) => pc.name === value)[0].columns + .tableState + ); const assoc = bodyshop.associations.find( (a) => a.useremail === currentUser.email @@ -77,6 +82,8 @@ export function ProductionListTable({ }; }) ); + + setState(bodyshop.production_config[0].columns.tableState); }; return ( diff --git a/client/src/components/production-list-table/production-list-table.component.jsx b/client/src/components/production-list-table/production-list-table.component.jsx index 59507c593..d08c5e7a9 100644 --- a/client/src/components/production-list-table/production-list-table.component.jsx +++ b/client/src/components/production-list-table/production-list-table.component.jsx @@ -38,17 +38,26 @@ export function ProductionListTable({ ); return assoc && assoc.default_prod_list_view; }, [bodyshop.associations, currentUser.email]); + console.log( + "🚀 ~ file: production-list-table.component.jsx ~ line 41 ~ defaultView", + defaultView + ); const [state, setState] = useState( (bodyshop.production_config && - bodyshop.production_config.find((p) => p.name === defaultView) - ?.tableState) || - bodyshop.production_config[0]?.tableState || { + bodyshop.production_config.find((p) => p.name === defaultView)?.columns + .tableState) || + bodyshop.production_config[0]?.columns.tableState || { sortedInfo: {}, filteredInfo: { text: "" }, } ); + console.log( + "🚀 ~ file: production-list-table.component.jsx ~ line 51 ~ bodyshop.production_config", + bodyshop.production_config + ); + console.log("state", state); const { t } = useTranslation(); const matchingColumnConfig = useMemo(() => { @@ -155,7 +164,7 @@ export function ProductionListTable({ // } // }; - if (!!!columns) return