@@ -21,7 +21,8 @@ extension NavigationLink {
2121 function: String = #function,
2222 line: UInt = #line,
2323 info: String ? = nil ,
24- dispatchActionOnTap: @escaping ( RowTag ) -> Action ,
24+ onOpen: @escaping ( RowTag ) -> Action ,
25+ onClose: @escaping ( ) -> Action ,
2526 @ViewBuilder label: @escaping ( ) -> Label
2627 ) {
2728 self . init (
@@ -32,7 +33,11 @@ extension NavigationLink {
3233 viewModel. state [ keyPath: pathToSelectedRowTag]
3334 } ,
3435 set: { row in
35- viewModel. dispatch ( dispatchActionOnTap ( row ?? rowTag) , from: . init( file: file, function: function, line: line, info: info) )
36+ if row != nil && row == rowTag {
37+ viewModel. dispatch ( onOpen ( rowTag) , from: . init( file: file, function: function, line: line, info: info) )
38+ } else if row == nil {
39+ viewModel. dispatch ( onClose ( ) , from: . init( file: file, function: function, line: line, info: info) )
40+ }
3641 } ) ,
3742 label: label)
3843 }
@@ -61,7 +66,7 @@ extension NavigationLink {
6166 self . init (
6267 destination: producer. view ( secondScreen) ,
6368 tag: secondScreen,
64- selection: store . binding [ path] { value in
69+ selection: Binding < ViewProducerContext ?> . store ( store , state : path, file : file , function : function , line : line , info : info ) { value in
6570 // We want to dispatch the pop action here in case the user
6671 // pops the detail screen so that the RouterReducer knows
6772 // to manipulate the NavigationTree.
0 commit comments