@@ -97,6 +97,8 @@ export const CippApiDialog = (props) => {
9797 } else {
9898 newData [ key ] = value ;
9999 }
100+ } else if ( typeof value === 'boolean' ) {
101+ newData [ key ] = value ;
100102 } else if ( typeof value === "object" && value !== null ) {
101103 const processedValue = processActionData ( value , row , replacementBehaviour ) ;
102104 if ( replacementBehaviour !== "removeNulls" || Object . keys ( processedValue ) . length > 0 ) {
@@ -273,20 +275,32 @@ export const CippApiDialog = (props) => {
273275 . reduce ( ( acc , key ) => ( acc && acc [ key ] !== undefined ? acc [ key ] : undefined ) , obj ) ;
274276 } ;
275277
276- // Handling link navigation
277- if ( api . link ) {
278+ // Handling external link navigation
279+ useEffect ( ( ) => {
280+ if ( api . link && createDialog . open ) {
281+ const linkWithRowData = api . link . replace ( / \[ ( [ ^ \] ] + ) \] / g, ( _ , key ) => {
282+ return getNestedValue ( row , key ) || `[${ key } ]` ;
283+ } ) ;
284+
285+ if ( ! linkWithRowData . startsWith ( "/" ) ) {
286+ window . open ( linkWithRowData , api . target || "_blank" ) ;
287+ createDialog . handleClose ( ) ;
288+ }
289+ }
290+ } , [ api . link , createDialog . open ] ) ;
291+
292+ // Handling internal link navigation
293+ if ( api . link && createDialog . open ) {
278294 const linkWithRowData = api . link . replace ( / \[ ( [ ^ \] ] + ) \] / g, ( _ , key ) => {
279295 return getNestedValue ( row , key ) || `[${ key } ]` ;
280296 } ) ;
281297
282298 if ( linkWithRowData . startsWith ( "/" ) ) {
283299 router . push ( linkWithRowData , undefined , { shallow : true } ) ;
284- } else {
285- window . open ( linkWithRowData , api . target || "_blank" ) ;
300+ createDialog . handleClose ( ) ;
286301 }
287-
288- return null ;
289302 }
303+
290304 useEffect ( ( ) => {
291305 if ( api . noConfirm ) {
292306 formHook . handleSubmit ( onSubmit ) ( ) ; // Submits the form on mount
0 commit comments