@@ -573,17 +573,33 @@ impl App {
573
573
store_context : Option < & StoreContext < ' _ > > ,
574
574
cmd : UICommand ,
575
575
) {
576
+ let mut force_store_info = false ;
576
577
let active_application_id = store_context
577
578
. and_then ( |ctx| {
578
579
ctx. hub
579
580
. active_app ( )
580
581
// Don't redirect data to the welcome screen.
581
582
. filter ( |& app_id| app_id != & StoreHub :: welcome_screen_app_id ( ) )
583
+ . cloned ( )
582
584
} )
583
- . cloned ( ) ;
585
+ // If we don't have any application ID to recommend (which means we are on the welcome screen),
586
+ // then just generate a new one using a UUID.
587
+ . or_else ( || Some ( uuid:: Uuid :: new_v4 ( ) . to_string ( ) . into ( ) ) ) ;
584
588
let active_recording_id = store_context
585
- . and_then ( |ctx| ctx. hub . active_recording_id ( ) )
586
- . cloned ( ) ;
589
+ . and_then ( |ctx| ctx. hub . active_recording_id ( ) . cloned ( ) )
590
+ . or_else ( || {
591
+ // When we're on the welcome screen, there is no recording ID to recommend.
592
+ // But we want one, otherwise multiple things being dropped simultaneously on the
593
+ // welcome screen would end up in different recordings!
594
+
595
+ // We're creating a recording just-in-time, directly from the viewer.
596
+ // We need those store infos or the data will just be silently ignored.
597
+ force_store_info = true ;
598
+
599
+ // NOTE: We don't override blueprints' store IDs anyhow, so it is sound to assume that
600
+ // this can only be a recording.
601
+ Some ( re_log_types:: StoreId :: random ( StoreKind :: Recording ) )
602
+ } ) ;
587
603
588
604
match cmd {
589
605
UICommand :: SaveRecording => {
@@ -615,6 +631,7 @@ impl App {
615
631
FileSource :: FileDialog {
616
632
recommended_application_id : None ,
617
633
recommended_recording_id : None ,
634
+ force_store_info,
618
635
} ,
619
636
file_path,
620
637
) ) ) ;
@@ -624,18 +641,15 @@ impl App {
624
641
UICommand :: Open => {
625
642
let egui_ctx = egui_ctx. clone ( ) ;
626
643
627
- // Open: we want to try and load into a new dedicated recording.
628
- let recommended_application_id = None ;
629
- let recommended_recording_id = None ;
630
644
let promise = poll_promise:: Promise :: spawn_local ( async move {
631
645
let file = async_open_rrd_dialog ( ) . await ;
632
646
egui_ctx. request_repaint ( ) ; // Wake ui thread
633
647
file
634
648
} ) ;
635
649
636
650
self . open_files_promise = Some ( PendingFilePromise {
637
- recommended_application_id,
638
- recommended_recording_id,
651
+ recommended_application_id : None ,
652
+ recommended_recording_id : None ,
639
653
promise,
640
654
} ) ;
641
655
}
@@ -648,6 +662,7 @@ impl App {
648
662
FileSource :: FileDialog {
649
663
recommended_application_id : active_application_id. clone ( ) ,
650
664
recommended_recording_id : active_recording_id. clone ( ) ,
665
+ force_store_info,
651
666
} ,
652
667
file_path,
653
668
) ) ) ;
@@ -657,19 +672,15 @@ impl App {
657
672
UICommand :: Import => {
658
673
let egui_ctx = egui_ctx. clone ( ) ;
659
674
660
- // Import: we want to try and load into the current recording.
661
- let recommended_application_id = active_application_id;
662
- let recommended_recording_id = active_recording_id;
663
-
664
675
let promise = poll_promise:: Promise :: spawn_local ( async move {
665
676
let file = async_open_rrd_dialog ( ) . await ;
666
677
egui_ctx. request_repaint ( ) ; // Wake ui thread
667
678
file
668
679
} ) ;
669
680
670
681
self . open_files_promise = Some ( PendingFilePromise {
671
- recommended_application_id,
672
- recommended_recording_id,
682
+ recommended_application_id : active_application_id . clone ( ) ,
683
+ recommended_recording_id : active_recording_id . clone ( ) ,
673
684
promise,
674
685
} ) ;
675
686
}
@@ -1364,17 +1375,33 @@ impl App {
1364
1375
return ;
1365
1376
}
1366
1377
1378
+ let mut force_store_info = false ;
1367
1379
let active_application_id = store_ctx
1368
1380
. and_then ( |ctx| {
1369
1381
ctx. hub
1370
1382
. active_app ( )
1371
1383
// Don't redirect data to the welcome screen.
1372
1384
. filter ( |& app_id| app_id != & StoreHub :: welcome_screen_app_id ( ) )
1385
+ . cloned ( )
1373
1386
} )
1374
- . cloned ( ) ;
1387
+ // If we don't have any application ID to recommend (which means we are on the welcome screen),
1388
+ // then just generate a new one using a UUID.
1389
+ . or_else ( || Some ( uuid:: Uuid :: new_v4 ( ) . to_string ( ) . into ( ) ) ) ;
1375
1390
let active_recording_id = store_ctx
1376
- . and_then ( |ctx| ctx. hub . active_recording_id ( ) )
1377
- . cloned ( ) ;
1391
+ . and_then ( |ctx| ctx. hub . active_recording_id ( ) . cloned ( ) )
1392
+ . or_else ( || {
1393
+ // When we're on the welcome screen, there is no recording ID to recommend.
1394
+ // But we want one, otherwise multiple things being dropped simultaneously on the
1395
+ // welcome screen would end up in different recordings!
1396
+
1397
+ // We're creating a recording just-in-time, directly from the viewer.
1398
+ // We need those store infos or the data will just be silently ignored.
1399
+ force_store_info = true ;
1400
+
1401
+ // NOTE: We don't override blueprints' store IDs anyhow, so it is sound to assume that
1402
+ // this can only be a recording.
1403
+ Some ( re_log_types:: StoreId :: random ( StoreKind :: Recording ) )
1404
+ } ) ;
1378
1405
1379
1406
for file in dropped_files {
1380
1407
if let Some ( bytes) = file. bytes {
@@ -1384,6 +1411,7 @@ impl App {
1384
1411
FileSource :: DragAndDrop {
1385
1412
recommended_application_id : active_application_id. clone ( ) ,
1386
1413
recommended_recording_id : active_recording_id. clone ( ) ,
1414
+ force_store_info,
1387
1415
} ,
1388
1416
FileContents {
1389
1417
name : file. name . clone ( ) ,
@@ -1400,6 +1428,7 @@ impl App {
1400
1428
FileSource :: DragAndDrop {
1401
1429
recommended_application_id : active_application_id. clone ( ) ,
1402
1430
recommended_recording_id : active_recording_id. clone ( ) ,
1431
+ force_store_info,
1403
1432
} ,
1404
1433
path,
1405
1434
) ) ) ;
0 commit comments