diff --git a/CHANGELOG.md b/CHANGELOG.md index 9544f9e03a..58f7d92ab6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,9 @@ ### 🐞 Bug Fixes -* Fix bug where `DashContainerModel.addView` would throw when adding a view to a row or column +* `DashContainerModel` fixes: + * Fix bug where `addView` would throw when adding a view to a row or column + * Fix bug where `allowRemove` flag was dropped from state for containers ## 59.1.0 - 2023-09-20 diff --git a/desktop/cmp/dash/container/impl/DashContainerUtils.ts b/desktop/cmp/dash/container/impl/DashContainerUtils.ts index 2618edf6fc..cc5dec4088 100644 --- a/desktop/cmp/dash/container/impl/DashContainerUtils.ts +++ b/desktop/cmp/dash/container/impl/DashContainerUtils.ts @@ -46,8 +46,8 @@ function convertGLToStateInner(configItems = [], contentItems = [], dashContaine ret.push(view); } else { - const {type, width, height, activeItemIndex, content} = configItem, - container = {type} as PlainObject; + const {type, width, height, activeItemIndex, content, isClosable} = configItem, + container = {type, allowRemove: isClosable} as PlainObject; if (isFinite(width)) container.width = round(width, 2); if (isFinite(height)) container.height = round(height, 2); @@ -138,12 +138,12 @@ function convertStateToGLInner(items = [], viewSpecs = [], containerSize, contai const content = convertStateToGLInner(item.content, viewSpecs, itemSize, item).filter( it => !isNil(it) ); - if (!content.length) return null; + if (!content.length && item.allowRemove) return null; // Below is a workaround for issue https://github.com/golden-layout/golden-layout/issues/418 // GoldenLayouts can sometimes export its state with an out-of-bounds `activeItemIndex`. // If we encounter this, we overwrite `activeItemIndex` to point to the last item. - const ret = {...item, content}; + const ret = {...item, content, isClosable: item.allowRemove}; if ( type === 'stack' && isFinite(ret.activeItemIndex) &&