File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -295,7 +295,7 @@ pub enum VariablesBackendReply {
295
295
ClipboardFormatReply ( FormattedVariable ) ,
296
296
297
297
/// The ID of the viewer that was opened.
298
- ViewReply ( String ) ,
298
+ ViewReply ( Option < String > ) ,
299
299
300
300
}
301
301
Original file line number Diff line number Diff line change @@ -367,16 +367,16 @@ impl RVariables {
367
367
/// Open a data viewer for the given variable.
368
368
///
369
369
/// - `path`: The path to the variable to view, as an array of access keys
370
- fn view ( & mut self , path : & Vec < String > ) -> Result < String , harp:: error:: Error > {
370
+ ///
371
+ /// Returns the ID of the comm managing the view, if any.
372
+ fn view ( & mut self , path : & Vec < String > ) -> Result < Option < String > , harp:: error:: Error > {
371
373
r_task ( || {
372
374
let env = self . env . get ( ) . clone ( ) ;
373
375
let obj = PositronVariable :: resolve_data_object ( env. clone ( ) , & path) ?;
374
376
375
377
if r_is_function ( obj. sexp ) {
376
378
harp:: as_result ( view ( & obj, & path, & env) ) ?;
377
-
378
- // Return a falsy `viewerId`. Should ideally be a more explicit `None`.
379
- return Ok ( String :: from ( "" ) ) ;
379
+ return Ok ( None ) ;
380
380
}
381
381
382
382
let name = unsafe { path. get_unchecked ( path. len ( ) - 1 ) } ;
@@ -392,7 +392,7 @@ impl RVariables {
392
392
Some ( binding) ,
393
393
self . comm_manager_tx . clone ( ) ,
394
394
) ?;
395
- Ok ( viewer_id)
395
+ Ok ( Some ( viewer_id) )
396
396
} )
397
397
}
398
398
You can’t perform that action at this time.
0 commit comments