@@ -3,6 +3,7 @@ import React from 'react';
33import { Button } from 'src/app-components/Button/Button' ;
44import { useAttachmentState } from 'src/features/attachments/hooks' ;
55import { useSetReturnToView } from 'src/features/form/layout/PageNavigationContext' ;
6+ import { useLayoutSets } from 'src/features/form/layoutSets/LayoutSetsProvider' ;
67import { useProcessNext } from 'src/features/instance/useProcessNext' ;
78import { useProcessQuery , useTaskTypeFromBackend } from 'src/features/instance/useProcessQuery' ;
89import { Lang } from 'src/features/language/Lang' ;
@@ -12,7 +13,7 @@ import { getComponentFromMode } from 'src/layout/Button/getComponentFromMode';
1213import { ComponentStructureWrapper } from 'src/layout/ComponentStructureWrapper' ;
1314import { alignStyle } from 'src/layout/RepeatingGroup/Container/RepeatingGroupContainer' ;
1415import { ProcessTaskType } from 'src/types' ;
15- import { ELEMENT_TYPE } from 'src/types/shared ' ;
16+ import { behavesLikeDataTask } from 'src/utils/formLayout ' ;
1617import { useItemWhenType } from 'src/utils/layout/useNodeItem' ;
1718import type { PropsFromGenericComponent } from 'src/layout' ;
1819import type { CompInternal } from 'src/layout/layout' ;
@@ -30,10 +31,11 @@ export const ButtonComponent = ({ baseComponentId, ...componentProps }: PropsFro
3031 const currentTaskType = useTaskTypeFromBackend ( ) ;
3132 const { data : process } = useProcessQuery ( ) ;
3233 const currentTask = process ?. currentTask ;
33- const { actions, write, elementType : currentElementType } = currentTask ?? { } ;
34+ const { actions, write } = currentTask ?? { } ;
3435 const attachmentState = useAttachmentState ( ) ;
3536 const { mutate : processNext , isPending : isProcessingNext } = useProcessNext ( ) ;
3637 const { mutate : processConfirm , isPending : isConfirming } = useProcessNext ( { action : 'confirm' } ) ;
38+ const layoutSets = useLayoutSets ( ) ;
3739
3840 const setReturnToView = useSetReturnToView ( ) ;
3941
@@ -55,10 +57,8 @@ export const ButtonComponent = ({ baseComponentId, ...componentProps }: PropsFro
5557 }
5658
5759 function submitTask ( ) {
58- const isServiceTask = currentElementType === ELEMENT_TYPE . SERVICE_TASK ;
59-
6060 setReturnToView ?.( undefined ) ;
61- if ( currentTaskType === ProcessTaskType . Data || isServiceTask ) {
61+ if ( currentTaskType === ProcessTaskType . Data || behavesLikeDataTask ( currentTask ?. elementId , layoutSets ) ) {
6262 processNext ( ) ;
6363 } else if ( currentTaskType === ProcessTaskType . Confirm ) {
6464 processConfirm ( ) ;
0 commit comments