Skip to content

Commit

Permalink
fix: fallback to source editor if no form available
Browse files Browse the repository at this point in the history
  • Loading branch information
mortada-codes committed Jan 31, 2022
1 parent 9fadc00 commit 626f64c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/components/organisms/ActionsPane/ActionsPane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -311,13 +311,14 @@ const ActionsPane = (props: {contentHeight: string}) => {
}, [selectedResourceId, resourceMap]);

useEffect(() => {
if (
(activeTabKey === 'metadataForm' || activeTabKey === 'form') &&
(!selectedResourceId || !(resourceKindHandler && resourceKindHandler.formEditorOptions))
) {
if (activeTabKey === 'form' && !(resourceKindHandler && resourceKindHandler.formEditorOptions?.editorSchema)) {
setActiveTabKey('source');
}
}, [selectedResourceId, selectedResource, activeTabKey, resourceKindHandler]);

if (activeTabKey === 'metadataForm' && (!resourceKindHandler || isKustomizationResource(selectedResource))) {
setActiveTabKey('source');
}
}, [selectedResource, activeTabKey, resourceKindHandler]);

const isSelectedResourceUnsaved = useCallback(() => {
if (!selectedResource) {
Expand Down

0 comments on commit 626f64c

Please sign in to comment.