@@ -97,6 +97,8 @@ export const CippApiDialog = (props) => {
97
97
} else {
98
98
newData [ key ] = value ;
99
99
}
100
+ } else if ( typeof value === 'boolean' ) {
101
+ newData [ key ] = value ;
100
102
} else if ( typeof value === "object" && value !== null ) {
101
103
const processedValue = processActionData ( value , row , replacementBehaviour ) ;
102
104
if ( replacementBehaviour !== "removeNulls" || Object . keys ( processedValue ) . length > 0 ) {
@@ -273,20 +275,32 @@ export const CippApiDialog = (props) => {
273
275
. reduce ( ( acc , key ) => ( acc && acc [ key ] !== undefined ? acc [ key ] : undefined ) , obj ) ;
274
276
} ;
275
277
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 ) {
278
294
const linkWithRowData = api . link . replace ( / \[ ( [ ^ \] ] + ) \] / g, ( _ , key ) => {
279
295
return getNestedValue ( row , key ) || `[${ key } ]` ;
280
296
} ) ;
281
297
282
298
if ( linkWithRowData . startsWith ( "/" ) ) {
283
299
router . push ( linkWithRowData , undefined , { shallow : true } ) ;
284
- } else {
285
- window . open ( linkWithRowData , api . target || "_blank" ) ;
300
+ createDialog . handleClose ( ) ;
286
301
}
287
-
288
- return null ;
289
302
}
303
+
290
304
useEffect ( ( ) => {
291
305
if ( api . noConfirm ) {
292
306
formHook . handleSubmit ( onSubmit ) ( ) ; // Submits the form on mount
0 commit comments