Merged in feature/IO-2985-Production-List-View-Null-Handling (pull request #1818)

IO-2985-Production-List-View-Null-Handling - Handle Null md_production_config
This commit is contained in:
Dave Richer
2024-10-17 17:09:48 +00:00
3 changed files with 40 additions and 39 deletions

View File

@@ -185,7 +185,7 @@ function ProductionBoardKanbanComponent({ data, bodyshop, refetch, insertAuditTr
const cardSettings = useMemo(() => {
const kanbanSettings = associationSettings?.kanban_settings;
return mergeWithDefaults(kanbanSettings);
}, [associationSettings]);
}, [associationSettings?.kanban_settings]);
const handleSettingsChange = () => {
setFilter(defaultFilters);

View File

@@ -457,7 +457,8 @@ export function ProductionListConfigManager({
value={activeView}
disabled={open || isAddingNewProfile} // Disable the Select box when the popover is open or adding a new profile
>
{bodyshop.production_config
{bodyshop?.production_config &&
bodyshop.production_config
.slice()
.sort((a, b) =>
a.name === t("production.constants.main_profile")

View File

@@ -51,8 +51,8 @@ export function ProductionListTable({ loading, data, refetch, bodyshop, technici
const initialColumnsRef = useRef(
(initialStateRef.current &&
bodyshop.production_config
.find((p) => p.name === defaultView)
bodyshop?.production_config
?.find((p) => p.name === defaultView)
?.columns.columnKeys.map((k) => {
return {
...ProductionListColumns({
@@ -76,8 +76,8 @@ export function ProductionListTable({ loading, data, refetch, bodyshop, technici
const { t } = useTranslation();
const matchingColumnConfig = useMemo(() => {
return bodyshop.production_config.find((p) => p.name === defaultView);
}, [bodyshop.production_config, defaultView]);
return bodyshop?.production_config?.find((p) => p.name === defaultView);
}, [bodyshop.production_config]);
useEffect(() => {
const newColumns =